10297 - Beavergnaw

All about problems in Volume 102. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
nerocrux
New poster
Posts: 7
Joined: Fri Jul 30, 2004 5:14 am
Location: city of god

10297 - Beavergnaw

Post by nerocrux » Sat Jul 31, 2004 7:57 pm

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...

User avatar
Ghost77 dimen
Learning poster
Posts: 67
Joined: Sun Sep 22, 2002 5:40 am
Location: Taiwan

Post by Ghost77 dimen » Sun Aug 01, 2004 4:31 pm


Try calculus. It's an easy problem.

Good luck. 8)

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry » Mon Aug 02, 2004 3:15 am

You can also use binary search..

nerocrux
New poster
Posts: 7
Joined: Fri Jul 30, 2004 5:14 am
Location: city of god

Post by nerocrux » Mon Aug 02, 2004 7:25 pm

i see,i'll try,thank u guys!!

nerocrux
New poster
Posts: 7
Joined: Fri Jul 30, 2004 5:14 am
Location: city of god

10297 -- need formula

Post by nerocrux » Thu Aug 12, 2004 3:34 pm

I still cant figur out the formula for this problem.Can anyone give me some hints??THX a lot !!

Frostina
New poster
Posts: 23
Joined: Mon Dec 15, 2003 5:21 am

Post by Frostina » Sun Jul 17, 2005 5:07 am

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
Thanks for your help ! ;)

bonny
New poster
Posts: 3
Joined: Thu Aug 30, 2007 12:31 pm
Location: Dhaka

Post by bonny » Thu Aug 30, 2007 12:35 pm

The formula is:

d=(D^3-6*V/pi)^1/3

(but i'm still getting WA :cry: )

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

Re: 10297 - Beavergnaw

Post by mukit » Fri May 16, 2008 6:35 am

I don't see any reason of getting W.A.
I used double and solved the problem.

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 10297 - Beavergnaw

Post by Obaida » Sat May 17, 2008 10:40 am

For every one getting WA...
Check this point..

Code: Select all

pi=2*acos(0.0)
Hope this will solve the problem. 8)
try_try_try_try_&&&_try@try.com
This may be the address of success.

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 10297 - Beavergnaw

Post by lnr » Tue Jun 23, 2009 3:30 am

Hello,
Can anyone give some hint for this problem?
volume=1/3*(D/2)^2*D

avatar
New poster
Posts: 8
Joined: Wed Nov 16, 2011 6:44 pm

Re: 10297 - Beavergnaw

Post by avatar » Wed Nov 23, 2011 6:39 pm

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 :lol:
best of luck................... :D

leo13
New poster
Posts: 1
Joined: Fri Dec 05, 2014 11:25 am

10297

Post by leo13 » Fri Dec 05, 2014 11:38 am

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

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 10297

Post by lighted » Fri Dec 05, 2014 2:46 pm

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.

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

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10297 - Beavergnaw

Post by brianfry713 » Fri Dec 05, 2014 9:23 pm

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!

Post Reply

Return to “Volume 102 (10200-10299)”