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

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.
 

解决思路

这是一道很简单的计算几何题,本质就是计算点是否在指定的半圆内。

源码

 /*
poj 1000
version:1.0
author:Knight
Email:S.Knight.Work@gmail.com
*/ #include<cstdio>
#include<cmath>
using namespace std;
const double PI = 3.1415926;
int main(void)
{
double S;//被腐蚀陆地的总面积
double r;//腐蚀陆地的半径
int i,j;
int T;
double X,Y;//Fred的坐标
double Distance;//Fred据坐标原点的距离
scanf("%d", &T);
for (i=; i<=T; i++)
{
scanf("%lf%lf", &X, &Y);
Distance = sqrt(X * X + Y * Y);
S = 0.0;
for (j=; ; j++)
{
S += 50.0;
r = sqrt( * S / PI);
if (r >= Distance)
{
break;
}
}
printf("Property %d: This property will begin eroding in year %d.\n", i, j);
}
printf("END OF OUTPUT.\n");
return ;
}
 

[POJ 1005] I Think I Need a Houseboat C++解题的更多相关文章

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

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

  2. OpenJudge/Poj 1005 I Think I Need a Houseboat

    1.链接地址: http://bailian.openjudge.cn/practice/1005/ http://poj.org/problem?id=1005 2.题目: I Think I Ne ...

  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 : 浮点数运算

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

  5. poj 1005 I Think I Need a Houseboat

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

  6. I Think I Need a Houseboat POJ - 1005

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

  7. I Think I Need a Houseboat POJ - 1005(数学)

    题目大意 在二维坐标内选定一个点,问你当洪水以半圆形扩散且每年扩散50单位,哪一年这个点被被洪水侵蚀? 解法 代码 #include <iostream> #include <cst ...

  8. POJ 1005 解题报告

    1.题目描述   2.解题思路 好吧,这是个水题,我的目的暂时是把poj第一页刷之,所以水题也写写吧,这个题简单数学常识而已,给定坐标(x,y),易知当圆心为(0,0)时,半圆面积为0.5*PI*(x ...

  9. 1005 -- I Think I Need a Houseboat

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

随机推荐

  1. PHP超全局变量、魔术变量和魔术方法

    PHP超全局变量 $_GET 通过get方式传递的值(通过 URL 参数传递给当前脚本的变量的数组.) $_POST 通过post形式传递的值(当 HTTP POST 请求的 Content-Type ...

  2. 将一个字符与对应Ascii码互转

    package nicetime.com.practies; /** * Java中将一个字符与对应Ascii码互转 1 byte = 8bit 可以表示 0-127 */public class G ...

  3. Python中的绝对路径和相对路径

    大牛们应该对路径都很了解了,这篇文章主要给像我这样的入门小白普及常识用的,啊哈 下面的路径介绍针对windows,其他平台的暂时不是很了解. 在编写的py文件中打开文件的时候经常见到下面其中路径的表达 ...

  4. UVA 674 Coin Change 硬币转换(完全背包,常规)

    题意:有5种硬币,个数无限的,组成n元的不同方案有多少种? 思路:常规完全背包.重点在dp[0]=1,dp[j]中记录的是组成 j 元的方案数.状态转移方程dp[j+coin[i]]+=dp[j]. ...

  5. 2017.10.1 QBXT 模拟赛

    题目链接 T1 枚举右端点,前缀和优化.对于当前点x,答案为 sum[x][r]-sum[x][l-1]-(sum[z][r]-sum[z][l-1]) 整理为 sum[x][r]-sum[z][r] ...

  6. 洛谷 P1880 石子合并

    题目描述 在一个圆形操场的四周摆放N堆石子,现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得分. 试设计出1个算法,计算出将N堆石子合并成1 ...

  7. destoon登录后跳转到指定网址

    打开module\member\register.inc.php文件搜索:<input type="hidden" name="forward" valu ...

  8. 面试题-谈谈你对Java平台的理解

    平台无关性 GC 语言特性 面向对象 类库 异常处理 一次编译到处运行 JVM如何加载Class文件 Java反射 ClassLoader 种类 双亲委派机制 loadcalss和forName

  9. JS给数字加千位分隔符

    本文原链接:https://www.jianshu.com/p/928c68f92c0c JavaScript实现千位分隔符 将普通的数字转换为带千位分隔符格式的数字字符串是一个非常常见的问题,千位分 ...

  10. 查看numpy的类型

    查看一个变量的类型:type(img) 查看array中的数据值的类型:img.dtype 查看array的形状:img.shape