## 10678 - The Grazing Cow

Moderator: Board moderators

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

### 10678 - The Grazing Cow

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

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

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
Contact:
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
Contact:
Thanks jan bhai.

It is very helpful to me.I got accepted

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

### WHY WA

WHY WA

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

Debashis Maitra wrote:WHY WA

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.

Debashis Maitra
Learning poster
Posts: 62
Joined: Sun Jul 09, 2006 8:31 am
Location: University of Dhaka
Contact:
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

### WA...

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
Contact:
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

### Acc.

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

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

### Re: 10678 - The Grazing Cow

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

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

### Re: 10678 - The Grazing Cow

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