I Think I Need a Houseboat POJ - 1005

I Think I Need a Houseboat

 POJ - 1005

解题思路:水题

#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;
}
View Code

 

posted @ 2018-05-30 21:41  多一份不为什么的坚持  阅读(148)  评论(0编辑  收藏  举报