HDU 1065.I Think I Need a Houseboat

I Think I Need a Houseboat

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 27   Accepted Submission(s) : 11

Font: Times New Roman | Verdana | Georgia

Font Size: ← →

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.

Source

Mid-Atlantic USA 2001

#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
using namespace std;
int n,t;
double s,x,y,year;
int main()
{
    scanf("%d",&n);
    for(int t=1;t<=n;t++)
    {
        s=1.0;
        scanf("%lf%lf",&x,&y);
        s=3.1415926*(x*x+y*y)/2;
        printf("Property %d: ",t);
        printf("This property will begin eroding in year %d.\n",(int)(s/50)+1);
    }
    printf("END OF OUTPUT.\n");
    return 0;
}
时间: 2024-10-06 12:16:30

HDU 1065.I Think I Need a Houseboat的相关文章

hdu 1065 I Think I Need a Houseboat 水题,不过看discuss,应该有很多人在PI上栽跟头了

I Think I Need a Houseboat Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10431    Accepted Submission(s): 2927 Problem Description Fred Mapper is considering purchasing some land in Louisiana

ZOJ 1049 &amp;&amp;HDU 1065 I Think I Need a Houseboat

链接:click here 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 caus

HDU ACM 1065 I Think I Need a Houseboat

分析:告诉协调的房子,每年(0,0)作为一个半圆区域的中心将被添加50.请教如何多年以来,这家的位置将是半圆内.注意pi必须采取3.1415926管辖权. #include<iostream> #include<cmath> using namespace std; #define PI 3.1415926 //3.141592654就WA int main() { int T,t=0,year; double x,y,d,s; cin>>T; while(T--) {

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 mai

hdu 1065(推公式)

I Think I Need a Houseboat Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12114    Accepted Submission(s): 3407 Problem Description Fred Mapper is considering purchasing some land in Louisiana

poj 1065 Wooden Sticks / hdu 1257 最少拦截系统 DP 贪心

参考链接:http://blog.csdn.net/xiaohuan1991/article/details/6956629 (HDU 1257 解题思路一样就不继续讲解) POJ 1065题意:给你n个木块,分别给出其长度和重量,然后要对这些木块进行加工,如果木块1的长度和重量都不大于木块2, 那么这两个木块可以放在一起加工,从而只用花费1个时间单位.问要如何进行加工从而能够花费最少时间单位. 知识点: 偏序集:若一个集合A为偏序集,那么满足:1.任意一个元素X属于集合,那么这个元素X≤X 2

hdu 1124 OR toj 1065 数论

题目大意:求解n的阶乘末尾0的个数. 分析: 产生0的原因有:(1):2 * 5 (2):乘数末尾有0,如10, 200 不过(2)可以归到(1)中,10 = 2 * 5, 200 = 2 * 2 * 2 * 5 * 5 容易想到将n!分解成质数的乘积以后,只有2 * 5这种组合可以产生末尾的0,且2的个数一定比5的个数多,因为2^n总是比5^n早出现. 所以问题转换为求解n!中有多少个5出现.代码如下: 1 #include <iostream> 2 using namespace std;

转载:hdu 题目分类 (侵删)

转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116

poj 1065 Wooden Sticks 贪心

题目链接:http://poj.org/problem?id=1065 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1051 贪心 先按l升序再按w稳定升序 然后从头扫到尾取可以取的 然后再从头 直到全部取完 一年前第一次写这道题的时候写了两百行Orz 其中有70行归并排序自己手敲 刚刚翻看老代码真是感慨... #include <cstdio> #include <cstdlib> #include <ctime> #