分析:告诉协调的房子,每年(0,0)作为一个半圆区域的中心将被添加50。请教如何多年以来,这家的位置将是半圆内。注意pi必须采取3.1415926管辖权。
#include<iostream>
#include<cmath>
using namespace std;
#define PI 3.1415926 //3.141592654就WA
int main()
{
int T,t=0,year;
double x,y,d,s;
cin>>T;
while(T--)
{
cin>>x>>y;
d=x*x+y*y; //半径的平方
s=0.5*PI*d; //半圆的面积
year=ceil(s/50.0); //向上取整
cout<<"Property "<<++t<<": This property will begin eroding in year "<<year<<".\n";
if(T==0)
cout<<"END OF OUTPUT."<<endl;
}
return 0;
}
版权声明:本文博主原创文章。博客,未经同意不得转载。
转载于:https://www.cnblogs.com/bhlsheji/p/4906791.html