nylg-159-I Think I Need a Houseboat

本题思路是根据给出的坐标算出以坐标为边界的半圆的面积是多少,用面积除以每年侵蚀的面积50 就可以得出是多少年侵蚀

 1 #include<stdio.h>
 2 #include<algorithm>
 3 #include<functional>
 4 #define PI 3.1415926
 5 using namespace std;
 6 int main()
 7 {
 8     int n,i;
 9     while(scanf("%d",&n)!=EOF)
10     {
11         double x,y;
12         for(i=1;i<=n;i++)
13         {
14             scanf("%lf%lf",&x,&y);
15             printf("Property %d: This property will begin eroding in year %d.
",i,int((x*x+y*y)*PI/100)+1);
16         }
17         printf("END OF OUTPUT.
");
18     }
19     return 0;
20 }

原文地址:https://www.cnblogs.com/nylg-haozi/p/3175810.html