1.链接地址:

http://bailian.openjudge.cn/practice/1005/

http://poj.org/problem?id=1005

2.题目:

I Think I Need a Houseboat
Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 82376   Accepted: 35628

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.”

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.

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.

Source

3.思路:

重要的是理解题意

该地区已每年50的半圆面积侵蚀,已知离半圆圆心的距离,求需要多少年侵蚀到。

这里要上取整数,使用ceil函数,于math.h头文件中

4.代码:

 #include <iostream>
#include <cstdio>
#include <cmath> #define PI 3.1415926535898 using namespace std; int main()
{
int i; int n;
cin>>n; double x,y;
for(i = ; i <= n; ++i)
{
cin>>x>>y;
cout<<"Property "<<i<<": This property will begin eroding in year "<<(int)(ceil(PI * (x * x + y * y) / ))<<"."<<endl;
}
cout<<"END OF OUTPUT."<<endl;
return ;
}

OpenJudge/Poj 1005 I Think I Need a Houseboat的更多相关文章

  1. POJ. 1005 I Think I Need a Houseboat(水 )

    POJ. 1005 I Think I Need a Houseboat(水 ) 代码总览 #include <cstdio> #include <cstring> #incl ...

  2. [POJ 1005] I Think I Need a Houseboat C++解题

        I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 81874   ...

  3. poj 1005:I Think I Need a Houseboat(水题,模拟)

    I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Acce ...

  4. poj 1005 I Think I Need a Houseboat

    #include <iostream> using namespace std; const double pi = 3.1415926535; int main() { ;; doubl ...

  5. [POJ] #1005# I Think I Need a Houseboat : 浮点数运算

    一. 题目 I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 97512 ...

  6. I Think I Need a Houseboat POJ - 1005

    I Think I Need a Houseboat POJ - 1005 解题思路:水题 #include <iostream> #include <cstdio> #inc ...

  7. OpenJudge / Poj 2141 Message Decowding

    1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Deco ...

  8. OpenJudge/Poj 2105 IP Address

    1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...

  9. OpenJudge/Poj 2027 No Brainer

    1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...

随机推荐

  1. 解决SenTestingKit/SenTestingKit.h: No such file or directory

    在一个iOS项目中引入了单元测试,感觉项目间的依赖关系有些乱,就建了一个新的Project,再把原来的.h和.m加进去,编译时竟然出现“SenTestingKit/SenTestingKit.h: N ...

  2. EF中Database.SqlQuery

    本文转载:http://www.cnblogs.com/daimage/archive/2012/07/04/2575844.html EF中Database.SqlQuery<TElement ...

  3. 【转】二叉树 VS hashtable

    hash_table和二叉搜索树都经常被用来构建符号表(或者字典)以及相关的结构,并且他们都表现出了很高的效率.最近也在不同的程序中使用了这两种数据结构,实现完毕后思考一下,对两者做了一个简单的比较: ...

  4. 列式存储 V.S. 行式存储

    列式数据库 http://zh.wikipedia.org/wiki/%E5%88%97%E5%BC%8F%E6%95%B0%E6%8D%AE%E5%BA%93 列式存储与行式存储 http://my ...

  5. 进程关系之tcgetpgrp、tcsetpgrp和tcgetsid函数

    需要有一种方法来通知内核哪一个进程组是前台进程组,这样,终端设备驱动程序就能了解将终端输入和终端产生的信号送到何处. #include <unistd.h> pid_t tcgetpgrp ...

  6. 外网访问SVN

    1.路由端口映射: 进入路由器管理管理界面-->转发规则-->虚拟服务器 将端口3690(svn默认端口)和你的局域网IP(如192.168.1.104)映射,勾上“启动”,保存,OK了. ...

  7. h5拖放-拖拽购物车

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  8. I P 127.X.X.X 和 0.0.0.0

    127.x.x.x 这是大家最熟悉不过的本地loopback地址,在windows和linux上等价于localhost. 我们习惯于使用127.0.0.1,实际上, 如果你在命令行下ping 127 ...

  9. 设定范围和步长的递增数验证器Validator

    1.接口注释 @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER}) @Retention(RUNTIME) @Docume ...

  10. 项目移植过程中报:“Project facet Java version 1.7 is not supported.” 错误

    转载: http://my.oschina.net/nly/blog/349081 在移植eclipse项目时,如果遇到 报:“Project facet Java version 1.7 is no ...