I Think I Need a Houseboat

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 9530    Accepted Submission(s): 2733
Problem 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.”



Notes:



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

题意:给定一个从原点開始且中心在原点的半圆,每天以50mile^2的速度向外扩充。给你一个点。求第几天扩充的半圆能覆盖到它。

题解:这题最先開始想到的思路是模拟,可是考虑到模拟太耗时间又认为这题应该能找到规律,然后就拿着笔在演草纸上画了出来,规律是pi/2*(r[n]^2 - r[n-1]^2)=100; r[1]^2 = 100 / pi; r[n]表示第n天半圆覆盖的半径,这明显是一个等差数列,得到r[n]^2 = 100*n/pi;然后就该直接用公式了~

#include <stdio.h>

int main()
{
int t;
double x, y;
scanf("%d", &t);
for(int i = 1; i <= t; ++i){
scanf("%lf%lf", &x, &y);
printf("Property %d: This property will begin eroding in year %d.\n",
i, int((x*x + y*y) * 3.1415926 / 100 + 1));
}
printf("END OF OUTPUT.\n");
return 0;
}

HDU1065 I Think I Need a Houseboat 【数学递推】的更多相关文章

  1. POJ 3597 种类数 数学+递推

    http://poj.org/problem?id=3597 题目大意:把一个正多边形分成数个三角形或者四边形,问有多少种方案. 思路:http://www.cnblogs.com/Ritchie/p ...

  2. BZOJ-1045 糖果传递 数学+递推

    1045: [HAOI2008] 糖果传递 Time Limit: 10 Sec Memory Limit: 162 MB Submit: 2975 Solved: 1327 [Submit][Sta ...

  3. UVa 10943 (数学 递推) How do you add?

    将K个不超过N的非负整数加起来,使它们的和为N,一共有多少种方法. 设d(i, j)表示j个不超过i的非负整数之和为i的方法数. d(i, j) = sum{ d(k, j-1) | 0 ≤ k ≤ ...

  4. ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)

    Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...

  5. ACM学习历程—Hihocoder 1164 随机斐波那契(数学递推)

    时间限制:5000ms 单点时限:1000ms 内存限制:256MB 描述 大家对斐波那契数列想必都很熟悉: a0 = 1, a1 = 1, ai = ai-1 + ai-2,(i > 1). ...

  6. ACM学习历程——HDU4814 Golden Radio Base(数学递推) (12年成都区域赛)

    Description Golden ratio base (GRB) is a non-integer positional numeral system that uses the golden ...

  7. ACM学习历程——HDU4472 Count(数学递推) (12年长春区域赛)

    Description Prof. Tigris is the head of an archaeological team who is currently in charge of an exca ...

  8. [luogu]P1066 2^k进制数[数学][递推][高精度]

    [luogu]P1066 2^k进制数 题目描述 设r是个2^k 进制数,并满足以下条件: (1)r至少是个2位的2^k 进制数. (2)作为2^k 进制数,除最后一位外,r的每一位严格小于它右边相邻 ...

  9. LA 3882 经典约瑟夫环问题的数学递推解法

    就是经典约瑟夫环问题的裸题 我一开始一直没理解这个递推是怎么来的,后来终于理解了 假设问题是从n个人编号分别为0...n-1,取第k个, 则第k个人编号为k-1的淘汰,剩下的编号为  0,1,2,3. ...

随机推荐

  1. 无JavaScript实现选项卡轮转切换效果

    CSS:   .box{width:200px; height:100px; border:1px solid #ddd; overflow:hidden;}.list{width:200px; he ...

  2. 单元测试框架 unittest 的运行方法if __name__ == '__main__': unittest.main()

    1. if __name__ == '__main__': unittest.main()2. 测试用例实例根据测试的特点分组在一起. unittest为此提供了一个机制:测试套件由unittest' ...

  3. TFS在项目中Devops落地进程(上)

    经过近2年折腾,基于TFS的Devops主线工程大体落地完毕.在此大体回忆下中间的各种历程. 开始之前简单说下什么是TFS(Team Foundation Server). TFS是微软推出的一款AL ...

  4. C#算法面试题

    1.产生一个int数组,长度为100,并向其中随机插入1-100,并且不能重复. static void GetArray() { ]; ]; ; i < ; i++) { intArr[i] ...

  5. 重构手法之Extrct Method(提炼函数)

    返回总目录 本节包含3个手法: 1.Extract Method(提炼函数) 2.Inline Method(内联函数) 3.Inline Temp(内联临时变量) Extract Method(提炼 ...

  6. [转载] 从Hadoop到Spark的架构实践

    转载自http://www.csdn.net/article/2015-06-08/2824889 http://www.zhihu.com/question/26568496 当下,Spark已经在 ...

  7. nginx-http-concat资源文件合并模块

    网页中引入多个CSS和JS的时候,浏览器会发出很多(css个数+js个数)次网络请求,甚至有的网页中有数十个以上的CSS或JS文件,用户体验特别不好,正好可以利用nginx-http-concat n ...

  8. Verilog中变量位宽注意

    Verilog中,变量定义方式可以为:reg[位宽-1:0] 数据名:reg[位宽:1] 数据名.其他变量也类似. 以reg变量cnt为例,当cnt位宽为4时,可定义为reg[3:0] cnt,或者定 ...

  9. IBM的websphere MQ的c#使用

    1.关于websphere MQ的常用名词(针对Websphere MQ7.5版本) 队列管理器:为应用程序提供消息传递服务的程序.使用消息队列接口(MQI)的应用程序可以将消息放置到队列并可从队列中 ...

  10. lua lua解读

    1.线程状态宏定义(thread status) #define LUA_OK 0 #define LUA_YIELD 1 #define LUA_ERRRUN 2 #define LUA_ERRSY ...