symons

___________每一天都是幸福的!!

  博客园  ::  :: 新随笔  ::  :: 订阅 订阅  :: 管理

这题目只要读懂了意思就好做了,先求出来(0.0)到(x.y)的距离为r,然后求出来以r为半径的半圆的面积,然后再用这个面积除以50,再向上取整就可以啦。

 1 #include <stdio.h>
 2 #include <math.h>
 3 #include <stdlib.h>
 4 #define  eps 0.000000001
 5 #define  pie 3.1415926
 6 int main(){
 7     int t;
 8     double res;
 9     double area;
10     double r;
11     double x,y;
12     int cnt=1;
13     scanf("%d",&t);
14     while(t--){
15         scanf("%lf%lf",&x,&y);
16         r=sqrt( x*x+y*y );
17         area=(pie*r*r)/2;
18         res=area/50.0;
19         printf("Property %d: This property will begin eroding in year %d.\n",cnt++,(int)ceil(res));
20     }
21     printf("END OF OUTPUT.\n");
22     return 0;
23 }

 

posted on 2014-01-03 21:53  symons  阅读(163)  评论(0)    收藏  举报