POJ 1005(累加)

来源:互联网 发布:单片机isd1820语音模块 编辑:程序博客网 时间:2024/05/22 00:09
/* * POJ_1005.cpp * *  Created on: 2013年10月14日 *      Author: Administrator */#include <iostream>#include <cstdio>#include <cmath>using namespace std;const double PI = 3.141592653;int main(){int t;scanf("%d",&t);int counter = 1;while(t--){double x,y;scanf("%lf%lf",&x,&y);double r = sqrt(x*x + y*y);double target = PI*r*r/2;double sum = 0;int years = 0;while(sum < target){sum+=50;years++;}printf("Property %d: This property will begin eroding in year %d.\n",counter++,years);}printf("END OF OUTPUT.\n");return 0 ;}

原创粉丝点击