2 1.0 1.0 25.0 0.0
Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT.
/***** 题解: 根据房子坐标与原点为半径,原点为圆心做一个圆,算出面积之后将它除以五十,因为侵蚀速度是每年50平方英里,算出最大年限 floor 返回不大于x的最大整数(向下取整) ceil 返回大于x的最小整数(向上取整) *****/ #include "stdio.h" #include "math.h" #define N 3.1415926 int main(){int i,j,k,;double x,y,r,area;scanf("%d",&i);//i行数据 for(j=1;j<=i;j++){ scanf("%lf %lf",&x,&y);//房子坐标 r=sqrt(pow(x,2)+pow(y,2));//求出半径 area=pow(r,2)*N/2;//算出圆的面积 printf("Property %d: This property will begin eroding in year %d\n",j,(int)ceil(area/50.0));} printf("END OF OUTPUT.\n");return 0;}