10678 - The Grazing Cow

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

Moderator: Board moderators

S.M.ferdous
New poster
Posts: 13
Joined: Fri Nov 03, 2006 2:53 pm
Location: bangladesh
Contact:

10678 - The Grazing Cow

Post by S.M.ferdous » Sun Dec 17, 2006 5:29 pm

Hi everyone

I know its a very easy problem. it seems ellipse to me . I also know the area of ellipse is pi*a*b.

I know 'a' but how could I get 'b'. plz some one help me.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Sun Dec 17, 2006 5:55 pm


S.M.ferdous
New poster
Posts: 13
Joined: Fri Nov 03, 2006 2:53 pm
Location: bangladesh
Contact:

Post by S.M.ferdous » Sun Dec 17, 2006 6:22 pm

Thanks for your kind reply.

Please give me the logic to solve the problem. I go to the URL, but it is too difficult to search the correct thing which i required.Please discuss your logic.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Tue Dec 19, 2006 1:11 am

See the image below...

Code: Select all

Spoiler Removed...
L and D are given, you have to find b.
Last edited by Jan on Mon Jan 29, 2007 10:53 am, edited 1 time in total.
Ami ekhono shopno dekhi...
HomePage

S.M.ferdous
New poster
Posts: 13
Joined: Fri Nov 03, 2006 2:53 pm
Location: bangladesh
Contact:

Post by S.M.ferdous » Tue Dec 19, 2006 3:43 pm

Thanks jan bhai.

It is very helpful to me.I got accepted :lol:

User avatar
Debashis Maitra
Learning poster
Posts: 62
Joined: Sun Jul 09, 2006 8:31 am
Location: University of Dhaka
Contact:

WHY WA

Post by Debashis Maitra » Sat Dec 23, 2006 9:22 pm

WHY WA :cry:

Code: Select all


NO need to see it again

Last edited by Debashis Maitra on Sat Dec 23, 2006 9:33 pm, edited 2 times in total.
Akash chhoyar swopno
Dream to touch the sky

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Re: WHY WA

Post by helloneo » Sat Dec 23, 2006 9:25 pm

Debashis Maitra wrote:WHY WA :cry:

Code: Select all

CUT
In your code, 5 / 2 is 2 not 2.5 because 'int' doesn't keep floating point..
Last edited by helloneo on Sun Dec 24, 2006 5:12 am, edited 1 time in total.

User avatar
Debashis Maitra
Learning poster
Posts: 62
Joined: Sun Jul 09, 2006 8:31 am
Location: University of Dhaka
Contact:

Post by Debashis Maitra » Sat Dec 23, 2006 9:36 pm

Thnx helloneo

i am doing too much foolish mistakes
Akash chhoyar swopno
Dream to touch the sky

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

WA...

Post by Obaida » Sat Mar 08, 2008 8:07 am

Some one please help me.... It seems that WA is fixed for me.... I can't do anything....

Code: Select all

Code Removed
}
Last edited by Obaida on Sat Mar 08, 2008 11:49 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Sat Mar 08, 2008 11:14 am

use

Code: Select all

const double pi = 2*aocs(0.0);
Hope it helps.

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

Acc.

Post by Obaida » Sat Mar 08, 2008 11:42 am

Yes...I got Acc.
try_try_try_try_&&&_try@try.com
This may be the address of success.

ahmed
New poster
Posts: 9
Joined: Tue Mar 17, 2009 6:36 pm

Re: 10678 - The Grazing Cow

Post by ahmed » Mon Apr 06, 2009 4:51 pm

Can anyone please give me any suggestion about why I am getting WA?My code is given below:-

Code: Select all

#include<stdio.h>
#include<math.h>


int main(void)
{
	double a,b,l,d,pi=2*acos(0);
	int n;
	scanf("%d",&n);
	for(;n;n--)
	{

		scanf("%lf%lf",&d,&l);
		a=l/2;
		b=(double)sqrtl((l/2*l/2)-(d/2*d/2));
		printf("%.3lf\n",pi*a*b);
	}
	return 0;
}

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

Re: 10678 - The Grazing Cow

Post by Obaida » Mon Apr 06, 2009 10:08 pm

Replace the following part of your code:

Code: Select all

sqrtl((l/2*l/2)-(d/2*d/2));
with:

Code: Select all

sqrtl(((l/2)*(l/2))-((d/2)*(d/2)))
And remove your code after acc. :)
try_try_try_try_&&&_try@try.com
This may be the address of success.

ahmed
New poster
Posts: 9
Joined: Tue Mar 17, 2009 6:36 pm

Re: 10678 - The Grazing Cow

Post by ahmed » Tue Apr 07, 2009 3:01 pm

I have changed according to your suggestion,but I am still getting WA :( .Is there any special cases which I haven't considered.Can you give me some inputs to check?
Thanks for helping me out :)

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

Re: 10678 - The Grazing Cow

Post by Obaida » Wed Apr 08, 2009 7:05 am

remove the double before sqrtl.... hope you will get acc. :)
try_try_try_try_&&&_try@try.com
This may be the address of success.

Post Reply

Return to “Volume 106 (10600-10699)”