Page 1 of 2

10678 - The Grazing Cow

Posted: Sun Dec 17, 2006 5:29 pm
by S.M.ferdous
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.

Posted: Sun Dec 17, 2006 5:55 pm
by helloneo

Posted: Sun Dec 17, 2006 6:22 pm
by S.M.ferdous
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.

Posted: Tue Dec 19, 2006 1:11 am
by Jan
See the image below...

Code: Select all

Spoiler Removed...
L and D are given, you have to find b.

Posted: Tue Dec 19, 2006 3:43 pm
by S.M.ferdous
Thanks jan bhai.

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

WHY WA

Posted: Sat Dec 23, 2006 9:22 pm
by Debashis Maitra
WHY WA :cry:

Code: Select all


NO need to see it again


Re: WHY WA

Posted: Sat Dec 23, 2006 9:25 pm
by helloneo
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..

Posted: Sat Dec 23, 2006 9:36 pm
by Debashis Maitra
Thnx helloneo

i am doing too much foolish mistakes

WA...

Posted: Sat Mar 08, 2008 8:07 am
by Obaida
Some one please help me.... It seems that WA is fixed for me.... I can't do anything....

Code: Select all

Code Removed
}

Posted: Sat Mar 08, 2008 11:14 am
by Jan
use

Code: Select all

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

Acc.

Posted: Sat Mar 08, 2008 11:42 am
by Obaida
Yes...I got Acc.

Re: 10678 - The Grazing Cow

Posted: Mon Apr 06, 2009 4:51 pm
by ahmed
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;
}

Re: 10678 - The Grazing Cow

Posted: Mon Apr 06, 2009 10:08 pm
by Obaida
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. :)

Re: 10678 - The Grazing Cow

Posted: Tue Apr 07, 2009 3:01 pm
by ahmed
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 :)

Re: 10678 - The Grazing Cow

Posted: Wed Apr 08, 2009 7:05 am
by Obaida
remove the double before sqrtl.... hope you will get acc. :)