HDU1065 I Think I Need a Houseboat 【数学递推】
I Think I Need a Houseboat
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.)
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.
“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.
2
1.0 1.0
25.0 0.0
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 【数学递推】的更多相关文章
- POJ 3597 种类数 数学+递推
http://poj.org/problem?id=3597 题目大意:把一个正多边形分成数个三角形或者四边形,问有多少种方案. 思路:http://www.cnblogs.com/Ritchie/p ...
- BZOJ-1045 糖果传递 数学+递推
1045: [HAOI2008] 糖果传递 Time Limit: 10 Sec Memory Limit: 162 MB Submit: 2975 Solved: 1327 [Submit][Sta ...
- 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 ≤ ...
- ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)
Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...
- ACM学习历程—Hihocoder 1164 随机斐波那契(数学递推)
时间限制:5000ms 单点时限:1000ms 内存限制:256MB 描述 大家对斐波那契数列想必都很熟悉: a0 = 1, a1 = 1, ai = ai-1 + ai-2,(i > 1). ...
- ACM学习历程——HDU4814 Golden Radio Base(数学递推) (12年成都区域赛)
Description Golden ratio base (GRB) is a non-integer positional numeral system that uses the golden ...
- ACM学习历程——HDU4472 Count(数学递推) (12年长春区域赛)
Description Prof. Tigris is the head of an archaeological team who is currently in charge of an exca ...
- [luogu]P1066 2^k进制数[数学][递推][高精度]
[luogu]P1066 2^k进制数 题目描述 设r是个2^k 进制数,并满足以下条件: (1)r至少是个2位的2^k 进制数. (2)作为2^k 进制数,除最后一位外,r的每一位严格小于它右边相邻 ...
- LA 3882 经典约瑟夫环问题的数学递推解法
就是经典约瑟夫环问题的裸题 我一开始一直没理解这个递推是怎么来的,后来终于理解了 假设问题是从n个人编号分别为0...n-1,取第k个, 则第k个人编号为k-1的淘汰,剩下的编号为 0,1,2,3. ...
随机推荐
- linux-echo
echo 更新时间: 2017-10-11-11:55:24 echo:打印输出内容 参数选择 -e 激活转义字符 命令:echo 123 ,此命令 就会输出123 命令: echo -e &q ...
- RE:考勤系统的复盘
一大早看了 <美团旅行前端技术体系的思考与实践> 这篇文,恰巧又在昨天完成了一个项目.确实让我忍不住码篇总结,为自己做一个复盘. 历时两个月,考勤系统 这个项目总算能够称得上完成了.项目 ...
- hdu 6231 -- K-th Number(二分+尺取)
题目链接 Problem Description Alice are given an array A[1..N] with N numbers. Now Alice want to build an ...
- webpack学习笔记啊(幕课)
基础配置总结 webpack hello.js hello.bundle.js打包命令参数 --config filename : 指定其他名称做配置文件 --watch / -w : 监听文件改动, ...
- Intellij16创建Spring-Mybatis项目创(填)建(坑)记录,解决IDEA下找不到xml文件的问题
转入Intellij已经有1个月了,编程效率确实比Eclipse快了很多,而且可以直接使用Maven,然后就想写个小项目玩玩,架构搭建完后,想着万事俱备,又不是第一次玩框架,照葫芦画瓢撑死半天就能完成 ...
- 二、VueJs 填坑日记之基础项目构建
在上一篇文章中,大致介绍了一下本系列博文以及学习vuejs我们需要了解的一些概念,希望大家认真阅读,所谓知己知彼,百战百胜,学习也一样,工欲善其事,必先利其器,要想学好vuejs,那前提的概念一定要熟 ...
- Maven2的配置文件settings.xml
简介: 概览 当Maven运行过程中的各种配置,例如pom.xml,不想绑定到一个固定的project或者要分配给用户时,我们使用settings.xml中的settings元素来确定这些配置.这包含 ...
- Android 异步消息处理机制前篇(一):深入理解ThreadLocal
版权声明:本文出自汪磊的博客,转载请务必注明出处. ThreadLocal简介 ThreadLocal是一个线程内部的数据存储类,通过它可以在指定的线程中存储数据,数据存储以后,只有在指定线程中可以获 ...
- springMVC初探
MVC框架要做哪些事情? a,将url映射到java类,或者java类的方法上 b,封装用户提交的数据 c,处理请求->调用相关的业务处理—>封装响应的数据 d,将响应的数据进行渲染 sp ...
- 【朝花夕拾】朝花夕拾-Robot Framework实战演练之开篇
(原创文章,转载请注明出处.) 开博了,简单感慨两句. 前些年一直在做质量体系建设及团队管理的事,忽略了对测试技术热度的保持,这两年有幸重回开发测试第一线,颇感欣喜. 近期随着公司新业务的开展,需要快 ...