YT14-HDU-被侵蚀的土地

Problem Description

Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi
River. Since Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion.

After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The
semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.)

Input

The first line of input will be a positive integer indicating how many data sets will be included (N).

Each of the next N lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given.

Output

For each data set, a single line of output should appear. This line should take the form of:

“Property N: This property will begin eroding in year Z.”

Where N is the data set (counting from 1), and Z is the first year (start from 1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer.

After the last data set, this should print out “END OF OUTPUT.”

Notes:

1. No property will appear exactly on the semicircle boundary: it will either be inside or outside.

2. This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.

3. All locations are given in miles.

Sample Input

2
1.0 1.0
25.0 0.0

Sample Output

Property 1: This property will begin eroding in year 1.
Property 2: This property will begin eroding in year 20.
END OF OUTPUT. 

代码如下:

#include <iostream>
#include <cmath>
using namespace std;
#define pi 3.1415926
int main()
{
    int T,i,s;
    double m,n;
    cin>>T;
    i=1;
    while (T--)
    {
        cin>>m>>n;
        s=pi*(m*m+n*n)/100;
        cout<<"Property "<<i<<": This property will begin eroding in year "<<s+1<<"."<<endl;
        i++;
    }
    cout<<"END OF OUTPUT."<<endl;
    return 0;
}

运行结果:

时间: 2024-11-11 02:36:11

YT14-HDU-被侵蚀的土地的相关文章

杭电ACM 三 选地盖房防水淹(Math.ceil)

问题及代码: Problem Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to

codevs 2621 土地侵蚀

提交地址:http://codevs.cn/problem/2621/ 2621 土地侵蚀 时间限制: 1 s 空间限制: 32000 KB 题目等级 : 黄金 Gold 题目描述 Description Fred考虑要在美国路易斯安那州上购买一些地来修建他的房子.在调查这个陆地的过程中,他发现路易斯安那州每年都因密西西比河的侵蚀而萎缩50平方英里.自从Fred打算要在这里度过后半生起,他就需要知道他的地是否会被侵蚀掉. 做了一些调查后,Fred发现这里的陆地以半圆的形式被侵蚀.这个半圆是一个圆

2621 土地侵蚀

2621 土地侵蚀 时间限制: 1 s 空间限制: 32000 KB 题目等级 : 黄金 Gold 题解 查看运行结果 题目描述 Description Fred考虑要在美国路易斯安那州上购买一些地来修建他的房子.在调查这个陆地的过程中,他发现路易斯安那州每年都因密西西比河的侵蚀而萎缩50平方英里.自从Fred打算要在这里度过后半生起,他就需要知道他的地是否会被侵蚀掉. 做了一些调查后,Fred发现这里的陆地以半圆的形式被侵蚀.这个半圆是一个圆的一部分,圆心为(0,0),被横坐标轴而等分,横坐标

HDU - 2149 - Public Sale

先上题目: Public Sale Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4023    Accepted Submission(s): 2454 Problem Description 虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金.现在等待他的,就是像FarmJohn一样的农田生涯. 要种

hdu 2149 Public Sale(巴什博弈变形)

Public Sale Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3978    Accepted Submission(s): 2424 Problem Description 虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金.现在等待他的,就是像FarmJohn一样的农田生涯. 要种田得有田才行

hdu 2149Public Sale(博弈论 巴什博奕)

Public Sale Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5919    Accepted Submission(s): 3472 Problem Description 虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金.现在等待他的,就是像FarmJohn一样的农田生涯. 要种田得有田才行

HDU 4925 Apple Tree(模拟题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4925 解题报告:给你n*m的土地,现在对每一块土地有两种操作,最多只能在每块土地上进行两种操作,第一种是种苹果树操作,第二种是施肥操作,种苹果树操作可以使得该块地 长出一个苹果,施肥操作可以使得与这块土地相邻的土地的苹果产量变为原来的两倍,问可以得到的最多的苹果数量是多少? 例如一个4*4的土地,用1表示在该土地上做第一种操作,0表示在该土地上做第二种操作,可以得到最多苹果的操作如下: 0 1 0

HDU 2149 Public Sale (博弈论经典)

Public Sale Problem Description 虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金.现在等待他的,就是像FarmJohn一样的农田生涯. 要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地.于是,Lele带上他的全部积蓄,冲往拍卖会. 后来发现,整个拍卖会只有Lele和他的死对头Yueyue. 通过打听,Lele知道这场拍卖的规则是这样的:刚开始底价为0,两个人轮流开始加价,不过每次加

【HDU】1663 Eat the Trees

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1693 给出一块$r*c$的地,其中有的土地上种上了树,有些没有种上树,只能在种上树的地上走,通过走若干个回路,来走遍所有种树的土地.问有多少种走法. 插头DP. 既然可以走多个回路,似乎就不需要考虑括号序列合并的问题了,直接状压表示每一个位置有没有插头. 我写的转出. 1.如果当前点都没有上插头和左插头,那么插头无法延续,新建一个回路. 2.如果当前点都有上插头和左插头,回路在此处闭合. 3.如果上