OpenJudge/Poj 1005 I Think I Need a Houseboat

时间:2022-09-26 11:34:55

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

OpenJudge/Poj 1005 I Think I Need a Houseboat

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&period; 1005 I Think I Need a Houseboat(水 &rpar;

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

  2. &lbrack;POJ 1005&rsqb; I Think I Need a Houseboat C&plus;&plus;解题

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

  3. poj 1005&colon;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. &lbrack;POJ&rsqb; &num;1005&num; I Think I Need a Houseboat &colon; 浮点数运算

    一. 题目 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 &sol; Poj 2141 Message Decowding

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

  8. OpenJudge&sol;Poj 2105 IP Address

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

  9. OpenJudge&sol;Poj 2027 No Brainer

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

随机推荐

  1. Entity Framework 使用

    1.EF中Include方法的使用使用Include方法,告诉EF连接查询哪个外键属性,生成Inner join连接 //必须引用using System.Data.Entity;才能用Include ...

  2. Project和Module的介绍

    Project 和 Module 介绍 这两个概念是 IntelliJ IDEA 的必懂知识点之一,请务必要学会. 如果你是 Eclipse 用户,并且已经看了上面给的链接,那 IntelliJ ID ...

  3. 【Entity Framework】初级篇--ObjectContext、ObjectQuery、ObjectStateEntry、ObjectStateManager类的介绍

    本节,简单的介绍EF中的ObjectContext.ObjectQuery.ObjectStateEntry.ObjectStateManager这个几个比较重要的类,它们都位于System.Data ...

  4. C&plus;&plus;基本要点复习--------coursera程序设计实习(PKU)的lecture notes

    因为一些特性复杂,很多时候也用不到一些特性,所以忘记了,算是随笔,也当作一个临时查找的手册.没有什么顺序,很杂. 1.构造函数通过函数重载的机制可以有多个(不同的构造函数,参数个数,或者参数类型不同. ...

  5. 解决ScrollView中的ListView无法显示全

    问题描述: ListView加入到ScrollView中之后,发现只能显示其中一条,具体原因得看一下源代码.现在先贴一下方案 (转自:http://blog.csdn.net/hitlion2008/ ...

  6. 一个数组分四个ul并且每个ul里边有四个li显示

    <?php $a = $array; for($i=0;$i<4;$i++ ) {?> <ul class="new-hover"> <?php ...

  7. solr多集合配置

    1.1 多SolrCore配置 一个solr工程中可以配置多个SolrCore实例. 分享牛原创(尊重原创 转载对的时候第一行请注明,转载出处来自分享牛http://blog.csdn.net/qq_ ...

  8. &period;NET Core微服务之基于Ocelot&plus;Butterfly实现分布式追踪

    Tip: 此篇已加入.NET Core微服务基础系列文章索引 一.什么是Tracing? 微服务的特点决定了功能模块的部署是分布式的,以往在单应用环境下,所有的业务都在同一个服务器上,如果服务器出现错 ...

  9. python修炼第七天

    第七天面向对象进阶,面向对象编程理解还是有些难度的,但是我觉得如果弄明白了,要比函数编程过程编程省事多了.继续努力! 1.面向对象补充: 封装 广义上的封装:把变量和函数都放在类中狭义上的封装:把一些 ...

  10. 用CSS将select&sol;option文本居中

    <select> <option value="0">0</option> <option value="1"> ...