博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
I Think I Need a Houseboat(计算几何,水题)
阅读量:6262 次
发布时间:2019-06-22

本文共 2730 字,大约阅读时间需要 9 分钟。

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

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

21.0 1.025.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.
1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #include
11 #include
12 #include
13 using namespace std;14 #define ll long long15 #define cti const int16 #define ctll const long long17 #define dg(i) cout << '*' << i << endl;18 19 int main()20 {21 int n;22 int ca = 1;23 double x, y;24 cin >> n;25 while(n--)26 {27 cin >> x >> y;28 int t = ceil((x * x + y * y) * 3.1415 / 100.0);29 printf("Property %d: This property will begin eroding in year %d.\n", ca++, t);30 }31 puts("END OF OUTPUT.");32 return 0;33 }

 

转载地址:http://nzzpa.baihongyu.com/

你可能感兴趣的文章
spark 安装配置
查看>>
图片裁剪和异步上传插件--一步到位(记录)
查看>>
在Vs2012 中使用SQL Server 2012 Express LocalDB打开Sqlserver2012数据库
查看>>
【分享】博客美化(7)推荐几个优秀的自定义博客
查看>>
人工智能和机器学习领域的一些有趣的开源项目
查看>>
python sorted排序
查看>>
python中xrange和range的异同
查看>>
PHP根据ASCII码返回具体的字符
查看>>
atitit.系统架构图 的设计 与工具 attilax总结
查看>>
URAL 1774 A - Barber of the Army of Mages 最大流
查看>>
处理器(CPU)调度问题
查看>>
leetcode - 位运算题目汇总(下)
查看>>
多少个矩形被覆盖
查看>>
22、ASP.NET MVC入门到精通——搭建项目框架
查看>>
3-7 类的友元函数的应用
查看>>
IntelliJ IDEA安装 一些配置
查看>>
【算法之美】求解两个有序数组的中位数 — leetcode 4. Median of Two Sorted Arrays
查看>>
post请求和get请求
查看>>
零成本实现接口自动化测试 – Java+TestNG 测试Restful service
查看>>
源码安装php时出现Sorry, I cannot run apxs. Possible reasons follow:
查看>>