I think I need a boat house
I think I need a boat house.
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.
Solution:
include<stdio.h>
include<math.h>
define PI 3.1415927
int main(){
int n,year;
int i=1;
double s,x,y,redius;
scanf("%d",&n);
while(n--){
scanf("%lf %lf",&x,&y);
redius=x*x+y*y;
s=PI*redius/2.0;
year=(int)ceil(s/50.0);
printf("Property %d: This property will begin eroding in year %d.\n",i++,year);
}
printf("END OF OUTPUT.");
return 0;
}
I think I need a boat house的更多相关文章
- Lesson 20 One man in a boat
Text Fishing is my favourite sport. I often fish for hours without catching anything. But this does ...
- 【软件分析与挖掘】BOAT: An Experimental Platform for Researchers to Comparatively and Reproducibly Evaluate Bug Localization Techniques
摘要: 目前有许多的bug定位技术,但是,由于他们基于不同的数据集,而且有些数据集还不是公开的,甚至有些技术只应用于小数据集,不具有通用性,因此,不好比较这些技术之间的优劣. 因此,BOAT应运而生. ...
- HDU 4902 Nice boat (线段树)
Nice boat 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4902 Description There is an old country a ...
- HDU-4902 Nice boat
Nice boat Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- 【HDU】4092 Nice boat(多校第四场1006) ——线段树 懒惰标记
Nice boat Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) To ...
- 线段树 + 区间更新 ----- HDU 4902 : Nice boat
Nice boat Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- UOJ#204 【APIO2016】Boat
Time Limit: 70 Sec Memory Limit: 256 MBSubmit: 559 Solved: 248 Description 在首尔城中,汉江横贯东西.在汉江的北岸,从西向 ...
- C++练习--创建Boat类和Car类(含友元)
/* 定义Boat与Car两个类,二者都有weight属性, 定义二者的一个友元函数totalWeight()为外部函数, 计算二者的重量和. */ #include<iostream> ...
- hdu 4902 Nice boat(线段树区间改动,输出终于序列)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4902 Problem Description There is an old country and ...
随机推荐
- tp未验证内容-9
在tp的数据库配置中, convention.php中所有的选项都没有设置,要自己在Home/conf/config.php中自己设置, 注意几个地方,一是数据库的名字是: db_name,不是db_ ...
- Linux文件结构
/: 根目录,所有的目录.文件.设备都在/之下,/就是Linux文件系统的组织者,也是最上级的领导者. /bin: bin 就是二进制(binary)英文缩写.在一般的系统当中,都可以在这个目录下找到 ...
- PSR4规范
定义类名规则: 完全限定类名必须有一个顶级命名空间(Vendor Name): 完全限定类名可以有多个子命名空间: 完全限定类名应该有一个终止类名: 下划线在完全限定类名中是没有特殊含义的: 字母在完 ...
- MyEclipse运行Java出错:could not find the main class:test.program will exit(导入项目)
自己新建的项目运行没有任何问题.但是我导入的很早以前别人写的项目,然后run就会弹框could not find the main class:test.program will exit 请确认JA ...
- [原]编译flightGear
参考:flightgear编译博客201705 flightGear是三维飞行仿真软件,这个款软件是开源的,我们尝试用其源码完整编译一遍这个工程,并使用它. 它用到里以下扩展库: 空气动力学库:JSB ...
- StringRedisTemplate常用API
转载自网络: //向redis里存入数据和设置缓存时间stringRedisTemplate.opsForValue().set("test", "100",6 ...
- SQL LITE安装
SQLite是一款轻型的嵌入式关系数据库,轻量级,效率高,操作起来也特别方便我们今天来讲解一下SQLite的安装和一些基本操作SQLite下载我是64位机,下载下面的两个解压就好添加path环境变量, ...
- iis7.0 win7如何修改默认iis端口号
iis7与iis6的设置方法要详细很多.所以,在更改设置上,iis7反而显得更复杂.iis作为本地网页编辑环境,占用80端口都是理所当然的.但是,作为网页调试的技术人员,通常本地都会安装iis.Apa ...
- POJ3070 斐波那契数列 矩阵快速幂
题目链接:http://poj.org/problem?id=3070 题意就是让你求斐波那契数列,不过n非常大,只能用logn的矩阵快速幂来做了 刚学完矩阵快速幂刷的水题,POJ不能用万能头文件是真 ...
- 有关两个jar包中包含完全相同的包名和类名的加载问题
首先从表现层介绍,后续后深入原理. 1,先简单介绍maven如何生成jar文件方便测试 <plugin> <artifactId>maven-assembly-plugin&l ...