1. 程式人生 > >A - I Think I Need a Houseboat HDU - 1065(水題)

A - I Think I Need a Houseboat HDU - 1065(水題)

啊啊啊 scan 水題 put 開始 end code 題意 \n

題意:給你一個半圓,半圓以面積每年增加50平方英裏的速度擴張。問(x, y)在多少年後被覆蓋、

思路:emmm,其實最開始,還是打表的,因為每一年的半圓的半徑可以算出來。啊啊啊啊,其實這個方法是可以的。但是!!!wa了!

    為什麽?因為 ∏ 只可以取3.1415926 所以一直wa。

   然後,看了網上的題解!秒懂!其實面積是等差數列!然後把 ∏ 改了過來,秒ac

#include<cstdio>
#include<cmath>
#define IP acos(-1)
int main()
{
    int t;
    scanf("%d", &t);
    
for (int i = 1; i <= t; ++i) { double x, y; scanf("%lf%lf", &x, &y); printf("Property %d: This property will begin eroding in year %d.\n", i, int((x*x + y*y)*3.1415926 / 100.0 + 1)); } printf("END OF OUTPUT.\n"); }

A - I Think I Need a Houseboat HDU - 1065(水題)