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

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

  1. 2
  2. 1.0 1.0
  3. 25.0 0.0

Sample Output

  1. Property 1: This property will begin eroding in year 1.
  2. Property 2: This property will begin eroding in year 20.
  3. 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

 
  水题,模拟
  题意:以坐标(0,0)为中心,向外呈半圆扩张侵蚀,每年侵蚀50平方米,问哪一年能到达坐标(x,y)。
  思路:写一个循环,模拟侵蚀的过程。每年半径就变成 sqrt( (area + 100.0)/PI )。直到半径超过或等于 sqrt(x*x+y*y)。
  代码
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. const double PI = acos(-);
  5. int main()
  6. {
  7. int N,Case;
  8. double x,y;
  9. cin>>N;
  10. for(Case=;Case<=N;Case++){
  11. cin>>x>>y;
  12. double R2 = x*x+y*y, r2 = 100.0/PI,sum = ;
  13. int year = ;
  14. while(r2<R2){
  15. sum+=;
  16. r2 = sum/PI;
  17. year++;
  18. }
  19. cout<<"Property "<<Case<<": This property will begin eroding in year "<<year<<'.'<<endl;
  20. }
  21. cout<<"END OF OUTPUT."<<endl;
  22. return ;
  23. }

Freecode : www.cnblogs.com/yym2013

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. 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 C++解题

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

  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. POJ 2342 &&HDU 1520 Anniversary party 树形DP 水题

    一个公司的职员是分级制度的,所有员工刚好是一个树形结构,现在公司要举办一个聚会,邀请部分职员来参加. 要求: 1.为了聚会有趣,若邀请了一个职员,则该职员的直接上级(即父节点)和直接下级(即儿子节点) ...

  7. POJ 2195 一人一房 最小费用流 建图 水题

    Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21010   Accepted: 10614 Desc ...

  8. poj 2586 Y2K Accounting Bug(贪心算法,水题一枚)

    #include <iostream> using namespace std; /*248K 32MS*/ int main() { int s,d; while(cin>> ...

  9. POJ 1269 Intersecting Lines(线段相交,水题)

    id=1269" rel="nofollow">Intersecting Lines 大意:给你两条直线的坐标,推断两条直线是否共线.平行.相交.若相交.求出交点. ...

随机推荐

  1. mysql互换表中两列数据方法

    1.创建表及记录用于测试 ) unsigned ) ,) unsigned ,) unsigned NOT NULL COMMENT '现价', PRIMARY KEY (`id`) ) ENGINE ...

  2. django 操作数据库--orm(object relation mapping)---models

    思想 django为使用一种新的方式,即:关系对象映射(Object Relational Mapping,简称ORM). PHP:activerecord Java:Hibernate C#:Ent ...

  3. hadoop小试

    standard mode(标准模式) 下载 wget http://mirror.bit.edu.cn/apache/hadoop/common/stable/hadoop-2.7.2.tar.gz ...

  4. SqlServer coalesce函数

    SqlServer数据库中coalesce函数用法:在SqlServer2005中有了新的函数,它非常的实用,它就是coalesce函数,此函数可以返回参数中的第一个非空表达式,当你要在N个字段中选取 ...

  5. POJ 1426

    http://poj.org/problem?id=1426 一道广搜的题目. 题意就是给你一个n,要你求出n的倍数中,只存在0和1的那个数字 所谓的只存在0和1,那么就是某个数的十倍或者十倍+1,而 ...

  6. Appium+Robotframework实现Android应用的自动化测试-4:AppiumLibrary介绍和安装

    Appium是个好东东,Android,iOS都支持,并且居然RobotFramework也支持Appium了,这就是本文要介绍的AppiumLibrary. 通过前面的文章大家知道可以使用多种语言来 ...

  7. perl 引用(一)

    1. 普通变量引用 variable reference 引用就好比C语言的指针,引用变量存储被引用变量的地址.赋值时注意要在变量前加上 \;使用时要多加一个 $ . 当然,引用也可以成为简单变量,可 ...

  8. ACM/ICPC 之 昂贵的聘礼-最短路解法(POJ1062)

    //转移为最短路问题,枚举必经每一个不小于酋长等级的人的最短路 //Time:16Ms Memory:208K #include<iostream> #include<cstring ...

  9. nyoj366_D的小L_字典序_全排列

    D的小L 时间限制:4000 ms  |  内存限制:65535 KB 难度:2   描述       一天TC的匡匡找ACM的小L玩三国杀,但是这会小L忙着哩,不想和匡匡玩但又怕匡匡生气,这时小L给 ...

  10. ubuntu10.04+win7双系统,重装win7后,恢复grub引导菜单以及命令行引导linux

    我在我的小Y上安装了ubuntu10.04和win7旗舰版的双系统,采用的是grub引导.今天win7不知道哪儿出了问题,windows update更新一直报错,(当然360也是打不上滴)网上查了很 ...