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

Posted alingmaomao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A - I Think I Need a Houseboat HDU - 1065(水题)相关的知识,希望对你有一定的参考价值。

题意:给你一个半圆,半圆以面积每年增加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.
", i, int((x*x + y*y)*3.1415926 / 100.0 + 1));
    }
    printf("END OF OUTPUT.
");
}

 

以上是关于A - I Think I Need a Houseboat HDU - 1065(水题)的主要内容,如果未能解决你的问题,请参考以下文章

I Think I Need a Houseboat

POJ 1005 I Think I Need a Houseboat

POJ 1005 I Think I Need a Houseboat

POJ 1005 I Think I Need a Houseboat

hdu--1065--I Think I Need a Houseboat

1005 i think i need a houseboat