SPOJ keeps telling me W.A

Hi I am solving a problem on SPOJ and it keeps telling me that my answer is wrong but I checked with the test cases and my code gives the correct answer :/. Can you help me out?

Link: http://www.spoj.com/problems/SNOWMAN/
Here is the question:

Finally the time of the year has come where children can build snowmans. The children have collected some snow and ask you how big the snowman is going to be.

Assume that the snowman will consist of three spheres stacked on top of each other. The lower two spheres are of equal size, the smaller sphere (used for the head) will have a radius of 25 percent of the radius of the larger spheres.
Input

The first line of the input contains a number t ≤ 100, which indicates the number of test cases to follow. Each test case consists of a line with one integer a ≤ 500000, the amount of snow in cm3.
Output

For each test case, print a line with the height of the snowman in cm. Round this number down to the next smaller integer.
Example

Input:
2
100
500000

Output:
10
175


Here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int find_ht(int vol)
{
    double radius = pow(vol/(3*3.141592654), 1/3.0);
    int ht = static_cast<int>(floor((2*(2*radius))+(2*((1/3.0)*radius))));
    return ht;
}

int main()
{
    int t;
    cin >> t;
    vector<int> results;
    for(int i = 1; i<=t; i++)
    {
	int v;
	cin >> v;
	results.push_back(find_ht(v));
    }
    for(int j = 0; j<t; j++)
    {
	cout << results[j] << endl;
    }
    return 0;
}
Last edited on
Topic archived. No new replies allowed.