hdu 1065 I Think I Need a Houseboat
Posted hemeiwolong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hdu 1065 I Think I Need a Houseboat相关的知识,希望对你有一定的参考价值。
参考:https://blog.csdn.net/neoxuhaotian/article/details/6112147
https://blog.csdn.net/lionel_d/article/details/44198125
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #define pi 3.1415926 6 using namespace std; 7 int main() 8 { 9 int t; 10 while (cin>>t) 11 { 12 for (int j=1;j<=t;j++) 13 { 14 float d,x,y; 15 cin>>x>>y; 16 d=sqrt(x*x+y*y); 17 for (int i=1;;i++) 18 { 19 float s=i*100.0; 20 float r=sqrt(s/pi); 21 if (d<=r) 22 { 23 cout<<"Property "<<j<<": This property will begin eroding in year "<<i<<‘.‘<<endl; 24 break; 25 } 26 } 27 } 28 cout<<"END OF OUTPUT."<<endl;//注意此句位置,不要误放入j循环内! 29 } 30 31 return 0; 32 }
以上是关于hdu 1065 I Think I Need a Houseboat的主要内容,如果未能解决你的问题,请参考以下文章
A - I Think I Need a Houseboat HDU - 1065(水题)
POJ 1005 I Think I Need a Houseboat