hdu 1065(推公式)
I Think I Need a Houseboat
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12114 Accepted Submission(s): 3407
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.
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.
pi*R[n]^2-pi*R[n-1]^2 =100 得到 R[n]^2 = 100*n/pi
直接得结果,破题有毒,pi只能取3.1415926
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;
typedef long long LL;
const double pi = 3.1415926; int main()
{
int t;
scanf("%d",&t);
for(int i=; i<=t; i++)
{
double x,y;
scanf("%lf%lf",&x,&y);
double r = x*x+y*y; ///半径的平方
printf("Property %d: This property will begin eroding in year %d.\n",i,(int)((r)*pi/+));
}
printf("END OF OUTPUT.\n");
return ;
}
hdu 1065(推公式)的更多相关文章
- HDU 5047 推公式+别样输出
题意:给n个‘M'形,问最多能把平面分成多少区域 解法:推公式 : f(n) = 4n(4n+1)/2 - 9n + 1 = (8n+1)(n-1)+2 前面部分有可能超long long,所以要转化 ...
- hdu 2197 推公式
题意:由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串?答案mod2008.例如,100100不是本原串,因为他是由两 ...
- hdu 5073 推公式相邻质心转换
#include<stdio.h> #include<stdlib.h> #include<string.h> #define N 51000 int cmp(co ...
- HDU 4870 Rating(概率、期望、推公式) && ZOJ 3415 Zhou Yu
其实zoj 3415不是应该叫Yu Zhou吗...碰到ZOJ 3415之后用了第二个参考网址的方法去求通项,然后这次碰到4870不会搞.参考了chanme的,然后重新把周瑜跟排名都反复推导(不是推倒 ...
- 2017多校第7场 HDU 6128 Inverse of sum 推公式或者二次剩余
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6128 题意:给你n个数,问你有多少对i,j,满足i<j,并且1/(ai+aj)=1/ai+1/a ...
- HDU 4873 ZCC Loves Intersection(JAVA、大数、推公式)
在一个D维空间,只有整点,点的每个维度的值是0~n-1 .现每秒生成D条线段,第i条线段与第i维度的轴平行.问D条线段的相交期望. 生成线段[a1,a2]的方法(假设该线段为第i条,即与第i维度的轴平 ...
- Balls and Boxes---hdu5810(推公式)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5810 有n个球m个盒子,随机把球放到盒子中,求每个盒子球个数的方差的期望值 E[V]; 推公式吧,或者 ...
- CCF 201312-4 有趣的数 (数位DP, 状压DP, 组合数学+暴力枚举, 推公式, 矩阵快速幂)
问题描述 我们把一个数称为有趣的,当且仅当: 1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次. 2. 所有的0都出现在所有的1之前,而所有的2都出现在所有的3之前. 3. 最高 ...
- bjfu1211 推公式,筛素数
题目是求fun(n)的值 fun(n)= Gcd(3)+Gcd(4)+…+Gcd(i)+…+Gcd(n).Gcd(n)=gcd(C[n][1],C[n][2],……,C[n][n-1])C[n][k] ...
随机推荐
- 【单调队列】P1886 滑动窗口
GET 单调队列 题目描述 现在有一堆数字共N个数字(N<=10^6),以及一个大小为k的窗口.现在这个从左边开始向右滑动,每次滑动一个单位,求出每次滑动后窗口中的最大值和最小值. 例如: Th ...
- JDBC-防止SQL注入问题
String sql = "select * from user where name = '" + name + "' and password = '" ...
- SSL免费证书申请以及nginx配置https流程记录
设置https需要ssl 证书,可以通过FreeSSL[https://freessl.org/]申请. 流程记录: 输入域名,如 http://www.youdias.xin 选择品牌,如Let's ...
- MySQL_8.0.15_Windows10_X64 安装教程
最近学习的内容涉及到MySQL的知识,所以安装一个MySQL非常有必要,参考别人的教程安装过程还算顺利,其中遇到了一些问题查了一些也解决了,这里把整个安装过程梳理一遍,给大家一个参考. 我手里的电脑是 ...
- socketserver的使用
socketserver底层也是使用线程实现的并发,直接上代码 # server import socketserver ''' socketserver使用模式: 1 功能类 class Myser ...
- 合肥工业大学宣城校区大学生创新创业训练项目申报书:“基于Spark平台的人工智能知识的知识图谱构建”
- day37-- &MySQL step1
m1.客户端与数据库服务器端是通过socket来交互数据,对数据库的理解:数据库就是一个文件夹,表就类比文件.m2.常用语句#查看数据库show databases:#创建数据库create data ...
- luogu1251 餐巾计划问题
ss是源点,代表餐巾卖家,tt是汇点,代表记账收钱者. 记p(i)是i天早晨的可用毛巾数,q(i)是i天完了的废毛巾数. 建图见注释 #include <iostream> #includ ...
- 令人惊叹的sublime text 3 插件
1.ChineseLocalization------语言汉化.(新手必备) 2.SublimeTmpl------打开生成模板.(新手必备) 3.SublimeCodeIntel------代码自 ...
- 小甲鱼零基础入门PYTHON
000.愉快的开始 00:17:37 ☆ 001.我和Python的第一次亲密接触 00:13:26 ★ 002.用Python设计第一个游戏 00:24:00 ★ 003.小插曲之变量和字符 ...