Page 1 of 1
10297 - Beavergnaw
Posted: Sat Jul 31, 2004 7:57 pm
by nerocrux
Maybe I'm not understand the problem thoroughly but I don't know how to caolculate the volumn of 2 cones.Does the cylinder in the center of "D"?
THX...
Posted: Sun Aug 01, 2004 4:31 pm
by Ghost77 dimen
Try calculus. It's an easy problem.
Good luck. 
Posted: Mon Aug 02, 2004 3:15 am
by Larry
You can also use binary search..
Posted: Mon Aug 02, 2004 7:25 pm
by nerocrux
i see,i'll try,thank u guys!!
10297 -- need formula
Posted: Thu Aug 12, 2004 3:34 pm
by nerocrux
I still cant figur out the formula for this problem.Can anyone give me some hints??THX a lot !!
Posted: Sun Jul 17, 2005 5:07 am
by Frostina
the volumn of 2 cones can be calculated by this formula..
1/3 * pi * r * r * h
r of the circle of its bottom
h is the height of the cone
Posted: Thu Aug 30, 2007 12:35 pm
by bonny
The formula is:
d=(D^3-6*V/pi)^1/3
(but i'm still getting WA

)
Re: 10297 - Beavergnaw
Posted: Fri May 16, 2008 6:35 am
by mukit
I don't see any reason of getting W.A.
I used double and solved the problem.
Re: 10297 - Beavergnaw
Posted: Sat May 17, 2008 10:40 am
by Obaida
For every one getting WA...
Check this point..
Hope this will solve the problem.

Re: 10297 - Beavergnaw
Posted: Tue Jun 23, 2009 3:30 am
by lnr
Hello,
Can anyone give some hint for this problem?
volume=1/3*(D/2)^2*D
Re: 10297 - Beavergnaw
Posted: Wed Nov 23, 2011 6:39 pm
by avatar
though the following algorithm is long .but hope it may help u ,as it work fine
1.First find total volume (using the given diameter /height)
2.remaining volume=Total volume - eaten volume
3. then consider the two conic having the base of given D
4.then last remaining volume=(small solid cylinder in the middle-2*small cone)
5. from that find the asked d
best of luck...................

10297
Posted: Fri Dec 05, 2014 11:38 am
by leo13
while submitting my code in ANSI C 4.8.2 language i was getting wrong answer but when i submitted the same code in C++ 4.8.2 language i got accepted..... i am not understanding what differences have been created by changing the submission language.... please help... thanks in advance..here is my code :
Code: Select all
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define pi acos(-1)
int main()
{
double d,v,voc,vbc,ar,dic;
while(scanf("%lf%lf",&d,&v)==2)
{
if(d==0&&v==0)break;
voc=pi*(d/2.0)*(d/2.0)*d;
vbc=2*(1/3.0)*pi*(d/2.0)*(d/2.0)*(d/2.0);
ar=(voc-vbc)-v;
dic=cbrt((6*ar)/pi);
printf("%.3lf\n",dic);
}
return 0;
}
Re: 10297
Posted: Fri Dec 05, 2014 2:46 pm
by lighted
Post in existing thread, use search by problem number (10297).
I think problem is in
cbrt function of ANSI C 4.8.2 - GNU C Compiler's library. When you change
cbrt to
pow judge gives accepted in ANSI C.
Re: 10297 - Beavergnaw
Posted: Fri Dec 05, 2014 9:23 pm
by brianfry713
Yes, cbrt() is not part of ANSI C, it is returning 1.0 with any argument.