poj1005
来源:互联网 发布:微刊软件 编辑:程序博客网 时间:2024/05/29 03:31
I Think I Need a Houseboat
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 68929 Accepted: 29152
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.
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 <stdio.h>#include <math.h>int main(){int n, year, j=1;float x, y, s=0, l, i;scanf("%d",&n);while(j<=n){scanf("%f %f",&x,&y);l=sqrt( x * x + y * y );for(i=1;;i++){s=10 * sqrt(i/ 3.14159);if(s>l){year=i;break;}}printf("Property %d: This property will begin eroding in year %d.\n",j,year);j++;s=0;}printf("END OF OUTPUT.\n");return 0;}
- poj1005
- poj1005
- poj1005
- POJ1005
- POJ1005
- poj1005
- poj1005
- POJ1005
- POJ1005
- poj1005
- POJ1005
- poj1005
- poj1005
- Poj1005
- poj1005
- POJ1005
- poj1005
- poj1005
- 为什么要用Struts2 .
- 1.创建图形化界面
- iOS5.1CoreImage 人脸识别 Demo
- 2.加入窗口监听
- 如何在xp上 设置阻止端口
- poj1005
- 3.加入按钮活动监听
- 游戏开发笔记之五——游戏画面绘图(二)绘制位图
- 4.加入鼠标监听
- 雷军在2012年站长大会上的演讲实录--"七字诀":专注\极致\口碑\快
- Three20学习笔记(配置篇)
- 关于Visual C++ 6.0的调试技巧和经验总结
- 项目经理的任职条件:
- 5.加入键盘和文本框(一行)监听