poj1005 I Think I Need a Houseboat

这题目只要读懂了意思就好做了,先求出来(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.
",cnt++,(int)ceil(res));
20     }
21     printf("END OF OUTPUT.
");
22     return 0;
23 }
原文地址:https://www.cnblogs.com/symons1992/p/3504322.html