P1005 I Think I Need a Houseboat - 水题
P1005 I Think I Need a Houseboat -- 水题
#include <stdio.h> #include <stdlib.h> double pi = 3.1415926535898; int main(int argc, char *argv[]) { int cnt, i; float x, y; int year; scanf("%d", &cnt); for (i=1; i<=cnt; i++) { scanf("%f %f", &x, &y); double temp = pi * (x*x + y*y) / 100.0; year = temp; year += (temp - year > 0.0) ? 1 : 0; printf("Property %d: This property will begin eroding in year %d.\n", i, year); } printf("END OF OUTPUT."); return 0; }