您的位置:首页 > 其它

【POJ】1005. I Think I Need a Houseboat

2016-10-12 22:42 405 查看
#include <stdio.h>
#include <cmath>
#define pi 3.1415926536

using namespace std;

int main(int argc, char *argv[]) {
int n;
float x, y;
scanf("%d", &n);
float preR2, R2;
int i;
int count = 1;
while (n-- > 0) {
scanf("%f %f", &x, &y);
for (i = 1; ; i++) {
if (i == 1) {
R2 = (100 / pi);
} else {
R2 = (100 / pi + preR2);
}
if (pow(x, 2) + pow(y, 2) < R2) break;
preR2 = R2;
}
printf("Property %d: This property will begin eroding in year %d.\n", count, i);
count++;
}
printf("END OF OUTPUT.\n");

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: