Friday, February 18, 2011

10678 - The Grazing Cow



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

int main()
{
    register int d,l,t;
    double A,a,b,pi=2*acos(0);
    //freopen("in.txt","r",stdin);

    scanf("%d",&t);
    while(t--)
    {
        scanf("%d%d",&d,&l);

        a=d/2.0,b=l/2.0;
        b=sqrt(b*b-a*a);
        a=a+(l-d)/2.0;
        A=pi*a*b;

        printf("%0.3lf\n",A);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.