10297 - Beavergnaw
Moderator: Board moderators
10297 - Beavergnaw
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...
THX...
-
- Learning poster
- Posts: 67
- Joined: Sun Sep 22, 2002 5:40 am
- Location: Taiwan
10297 -- need formula
I still cant figur out the formula for this problem.Can anyone give me some hints??THX a lot !!
Re: 10297 - Beavergnaw
I don't see any reason of getting W.A.
I used double and solved the problem.
I used double and solved the problem.
Re: 10297 - Beavergnaw
For every one getting WA...
Check this point..
Hope this will solve the problem. ![8)](./images/smilies/icon_cool.gif)
Check this point..
Code: Select all
pi=2*acos(0.0)
![8)](./images/smilies/icon_cool.gif)
try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
Re: 10297 - Beavergnaw
Hello,
Can anyone give some hint for this problem?
volume=1/3*(D/2)^2*D
Can anyone give some hint for this problem?
volume=1/3*(D/2)^2*D
Re: 10297 - Beavergnaw
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...................![:D](./images/smilies/icon_biggrin.gif)
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
![:lol:](./images/smilies/icon_lol.gif)
best of luck...................
![:D](./images/smilies/icon_biggrin.gif)
10297
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;
}
Last edited by brianfry713 on Fri Dec 05, 2014 9:15 pm, edited 1 time in total.
Reason: Added code blocks
Reason: Added code blocks
Re: 10297
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.
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.
Code: Select all
dic = pow(6 * ar / pi, 1.0 / 3);
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10297 - Beavergnaw
Yes, cbrt() is not part of ANSI C, it is returning 1.0 with any argument.
Check input and AC output for thousands of problems on uDebug!