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] ...
随机推荐
- C语言程序运行
vs2013编辑器 c程序的运行 一.启动Microsoft Visual C++ 2013版.新建项目 . 1. 文件——> 新建——> 项目. 2. 确定之后 弹出 ...
- tensorflow目标检测API之训练自己的数据集
1.训练文件的配置 将生成的csv和record文件都放在新建的mydata文件夹下,并打开object_detection文件夹下的data文件夹,复制一个后缀为.pbtxt的文件到mtdata文件 ...
- Docker 镜像&仓库 获取及推送镜像
docker查看.删除镜像 docker镜像存储位置: /var/lib/docker 查看docker信息也可以查看保存位置 docker info 1.列出镜像 docker images -aa ...
- [提供可行性脚本] RHEL/CentOS 7 多节点SSH免密登陆
实验说明: 在自动化部署时,会经常SSH别的机器去操作,然而每次的密码认证却很令人烦躁,尤其是很长的密码,因此SSH免密登陆就显得必不可少: 在机器数目很多的时候,使用更过的往往是Ansible分发并 ...
- 【linux】【rpm】确定程序是否 rpm 安装
执行 rpm -qf 文件名如果结果显示出安装包那就说明是rpm (或者yum)安装 详情参看 rpm -v (或者 man rpm)
- java中类与对象的概念(2013-05-04-bd 写的日志迁移
1:类是抽象的,概念的,代表一类事物,比如人类.猫类.. 2:对象是具体的,实际的,代表一个具体的事物 3:类是对象的模板,对象是类的一个个体,实例 创建对象的两种方法: 1.先声明在创建 对象声明: ...
- Lecture 1
Principles of GIS( UNSW Metternicht ) outline:data input---data management---data manipulation+data ...
- Applied Nonparametric Statistics-lec5
今天继续two-sample test Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6 Mann ...
- 重新造轮子之静态链接2(Static linking)
有了上一篇的基础, 这次写一个我们已经滚瓜烂熟的C程序 helloworld .只不过这次我们不能用到到C语言中的main()函数. 实验环境: linux 编译器: gcc 编辑器:Vim 1. ...
- 将系统从.Net Core2.0升级到.Net Core2.1
最近将手头的一个.Net Core2.0开发的小系统升级到最新的Core2.1.升级期间遇到了一些问题,现将问题以及解决方法整理汇总一下. 一是作为笔记,二也为跟各位分享一下.如过能帮到看到这帖子的人 ...