2012年1月8日 星期日

ACM 10209 Is This Integration ?

[心得] :0.044



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

#define PI  2.0*acos(0.0)
#define line_area(r)  (r) * (r) * (1  + PI * 1.0 / 3.0 - sqrt(3))
#define point_area(r) (r) * (r) * (-4 + PI * 1.0 / 3.0 + sqrt(3) * 2)
#define square_area(r) (r) * (r) * (4  - PI * 2.0 / 3.0 - sqrt(3))

int main()
{
   double a;
   while(scanf("%lf",&a)==1)
   {
     printf("%.3lf %.3lf %.3lf\n",line_area(a),point_area(a),square_area(a));
   }

  system("pause");  
 // return 0;
}

沒有留言:

張貼留言