#include<iostream>
#include<cmath>
//#include<algorithm>
using namespace std;
#define PI 3.1415926
/*
return: years
*/
int recursionFunc(float rCurrent, float xYMin){
float r;
if(rCurrent==0){
r=sqrt(100.0/PI);
}else{
r=sqrt(100.0/PI+pow(rCurrent,2));
}
if(r>xYMin){
return 1;
}else{
return 1+recursionFunc(r, xYMin);
}
}
int main(int argc, char *argv[]){
int n;
float x,y;
float r;
cin>>n;
for(int i=0;i<n;i++){
cin>>x>>y;
r=sqrt(pow(x,2)+pow(y,2));
cout<<"Property "<<i+1<<": This property will begin eroding in year "<<recursionFunc(0,r)<<"."<<endl;
}
cout<<"END OF OUTPUT."<<endl;
return 0;
}
POJ-1005
最新推荐文章于 2019-03-10 12:59:03 发布