I Think I Need a Houseboat POJ - 1005
I Think I Need a Houseboat
解题思路:水题
#include <iostream> #include <cstdio> #include <cmath> using namespace std; int main() { int n; double xx,yy; double rr; double area,r; int year; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%lf %lf",&xx,&yy); rr=sqrt(xx*xx+yy*yy); year=0; area=0; while(1){ year++; area+=100; r=sqrt(area/3.1415926); if(r>=rr){ printf("Property %d: This property will begin eroding in year %d.\n",i+1,year); break; } } } printf("END OF OUTPUT."); return 0; }