HDU1065 I Think I Need a Houseboat
来源:互联网 发布:淘宝价格怎么设置打折 编辑:程序博客网 时间:2024/06/14 14:30
I Think I Need a Houseboat
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.
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.
“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.
————————————————————————————————————————
水题,算出所给点为半径的半圆面积去除以50 就可以了,要注意pi取3.1415926 刚开始多取了几位wa了,不甘心
#include<iostream>#include<cmath>using namespace std;#define pi 3.1415926int main(){ double x,y,s; int a,cnt,o; while(~scanf("%d",&o)) { cnt=0; for(int cnt=1;cnt<=o;cnt++) { scanf("%lf%lf",&x,&y); s = pi * (x*x+y*y)/2; a = (int)(s/50) + 1; printf("Property %d: This property will begin eroding in year %d.\n",cnt,a); } printf("END OF OUTPUT.\n"); } return 0;}
0 0
- hdu1065-I Think I Need a Houseboat
- HDU1065-I Think I Need a Houseboat
- HDU1065 I Think I Need a Houseboat
- I Think I Need a Houseboat(hdu1065水题)
- HDU1065---I Think I Need a Houseboat----HDU(82)
- HDU1065 I Think I Need a Houseboat 【数学递推】
- UVALive2363 POJ1005 HDU1065 ZOJ1049 I Think I Need a Houseboat【数学计算】
- 1049 I Think I Need a Houseboat
- I Think I Need a Houseboat
- 1005 I Think I Need a Houseboat
- 1005 I Think I Need a Houseboat
- I Think I Need a Houseboat
- 1005 I Think I Need a Houseboat
- 1065 I Think I Need a Houseboat
- 1005 I Think I Need a Houseboat
- I Think I Need a Houseboat
- POJ - I Think I Need a Houseboat
- poj1005---I Think I Need a Houseboat
- uva 10943 How do you add?
- Android HTML 中添加空格
- JavaSE基础(六)
- caffe与Python接口的配置(VC2013 Windows CUDA7.5 Python2.7.12)
- 2016 Multi-University Training Contest 1 1001 Abandoned country
- HDU1065 I Think I Need a Houseboat
- PHP常用的设计模式
- Java多线程面试问题
- 浅谈android中手机联系人字母索引表的实现
- HDU 5735 Born Slippy ( from:2016 Multi-University Training Contest 2 )
- 2015蓝桥杯C组试题 打印大X
- Linux下opencv编译两种方式
- 13道简单算法题
- 精选30道Java笔试题解答