POJ 1005 I Think I Need a Houseboat
問題文要約
図のような島があり、1年で50平方マイルずつ中心から半円で侵食していく。座標が与えられるので、その座標の位置が侵食される年数を出力せよ。
#include <cmath> #include <cstdio> using namespace std; const double PI = acos(-1); int main(){ int n,year; double a,b; scanf("%d",&n); for(int i = 0; i < n; i++){ scanf("%lf%lf",&a,&b); year = ceil((a * a + b * b) * PI / (50 * 2)); printf("Property %d: This property will begin eroding in year %d.\n",i+1,year); } puts("END OF OUTPUT."); }