Computer Programming Contest Preparation

ToolBox - Source for: 106/10678/judged.c



/home/toolbox/public_html/solutions/106/10678/judged.c
    1 #include <stdio.h>
    2 #include <math.h>
    3 
    4 #define PI (double) 3.14159265358979323846264338327950288419716939937510582097494459
    5 
    6 int main()
    7 {
    8 
    9     int cnt;
   10     int i;
   11     int d;
   12     int l;
   13     double r1;
   14     double r2;
   15     double rope;
   16     double poles;
   17     double t1;
   18     double t2;
   19 
   20     scanf("%d ", &cnt);
   21     for (i=0; i< cnt; i++)
   22         {
   23             /* for */
   24             scanf("%d %d ", &d, &l);
   25             poles = d;
   26             rope = l;
   27             t1 = poles / (double) 2;
   28             r2 = rope / (double) 2;
   29             r1 = sqrt(r2 * r2 - t1 * t1);
   30             t2 = PI * r1 * r2;
   31             printf("%.3lf\n", t2);
   32 
   33         } /* for */
   34     return 0;
   35 }
   36 
   37 
   38