/*题目四:I Think I Need a Houseboat(PKU1005)
*作者:国风崽
*/
#include<iostream>
using namespace std;
int main(){
float x,y;//坐标
int testcase,t=0;
cin>>testcase;
while(testcase){
cin>>x>>y;
++t;
cout<<"Property "<<t<<": This property will begin eroding in year "<<(int)(3.1415926*(x*x+y*y)/100+1)<<"."<<endl;
--testcase;
}
cout<<"END OF OUTPUT."<<endl;
return 0;
}
*作者:国风崽
*/
#include<iostream>
using namespace std;
int main(){
float x,y;//坐标
int testcase,t=0;
cin>>testcase;
while(testcase){
cin>>x>>y;
++t;
cout<<"Property "<<t<<": This property will begin eroding in year "<<(int)(3.1415926*(x*x+y*y)/100+1)<<"."<<endl;
--testcase;
}
cout<<"END OF OUTPUT."<<endl;
return 0;
}
本程序通过输入房产坐标预测其开始受侵蚀的年份。利用圆周率π计算坐标(x, y)对应的房产面积,并据此估算侵蚀开始的时间。适用于解决特定环境下的地理问题。
944

被折叠的 条评论
为什么被折叠?



