poj1005 -- I Think I Need a Houseboat
来源:互联网 发布:无缝丝袜淘宝贴吧 编辑:程序博客网 时间:2024/06/05 02:14
I Think I Need a Houseboat
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 103343 Accepted: 44962
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.)
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.”
Sample Input
21.0 1.025.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.
Hint
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.
这题的大致意思就是:河水会侵蚀陆地,侵蚀的形状为一个半圆,第一年时X轴上方全是陆地,此后每年河水都会侵蚀陆地50平方英里(即半圆的面积每年都会增加50平方英里),给出房子的坐标,问多少年会被侵蚀。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.
代码如下:
#include <cstdio>#include <cmath>const double PI=3.1415926;int main(){ double a[1000]; double s=100; for(int i=0;i<1000;i++) { a[i]=sqrt(s/PI); s+=100; //半圆为50,整个圆就为100 } int n; scanf("%d",&n); int kase=0; while(n--) { double x,y; scanf("%lf%lf",&x,&y); double radius=sqrt(x*x+y*y); for(int i=0;i<1000;i++) { if(a[i]>=radius) { printf("Property %d: This property will begin eroding in year %d.\n",++kase,i+1); break; } } } printf("END OF OUTPUT.\n"); return 0;}
0 0
- poj1005---I Think I Need a Houseboat
- POJ1005 I Think I Need a Houseboat
- POJ1005 I Think I Need a Houseboat
- poj1005 I Think I Need a Houseboat
- POJ1005 I Think I Need a Houseboat
- poj1005 -- I Think I Need a Houseboat
- POJ1005-I Think I Need a Houseboat
- poj1005(I Think I Need a Houseboat)
- POJ1005·I Think I Need a Houseboat
- poj1005"I Think I Need a Houseboat"解题报告
- POJ1005,I Think I Need a Houseboat,数学水题
- poj1005——I Think I Need a Houseboat
- poj1005——I Think I Need a Houseboat
- POJ1005-I Think I Need a Houseboat(水题)
- poj1005 I Think I Need a Houseboat 水题
- POJ1005(I Think I Need a Houseboat)(水题不水)
- POJ1005 I Think I Need a Houseboat【π】
- UVALive2363 POJ1005 HDU1065 ZOJ1049 I Think I Need a Houseboat【数学计算】
- CodeBlocks 出现undefined reference to `GetOpenFileNameA@'问题时解决方案
- 【LeetCode】Keyboard Row 解题报告
- EditText中singleLine过期替代方法
- Java的日期与时间(六)java.sql.Timestamp
- transport.js文件(解决ecshop jquery jqzoom冲突)
- poj1005 -- I Think I Need a Houseboat
- Java的日期与时间(七)java.util.Calendar和GregorianCalendar
- Matlab-奈奎斯特滤波器实现《一》
- Hello World!
- vue.js 嵌套循环渲染
- 每天一个小题目——计算器的新功能
- 程序员的这108个笑话 都能看懂的技术应该不会太差!
- 拷贝构造函数和赋值运算符有哪些不同点和相同点
- TED如何和压力做朋友(第四天完)