10678 - The Grazing Cow

#include<bits/stdc++.h>
#define pi acos (-1)
using namespace std;

int main()
{
    int test;
    double a,b,c,D,L,store,area;
    scanf("%d",&test);
    while(test--)
    {
        scanf("%lf%lf",&D,&L);

        a=L/2.0;
        c=D/2.0;
        store=(a*a)-(c*c);

        b=sqrt(store);

        area=pi*a*b;

        printf("%.3lf\n",area);
    }
    return 0;
}

0 comments: (+add yours?)