POJ 1005
来源:互联网 发布:js获取数据第几个元素 编辑:程序博客网 时间:2024/05/22 05:04
这道题摆在OJ的前面,应该是水题没错。
题目大意就是判断给定的点在第几年会被淹掉,已知的是,每年水会淹没50平方英里的面积。
明显是一道计算题,第n年会淹到的半径为 根号(n*100)/PI , 这里注意的是 PI 可以预定义为3.1415926 ,精确一点也可以设为 acos(-1)
这里我为了避免开根号产生的 四舍五入的影响,干脆比较的是 半径的平方,即r_dou
这题因为输出格式 A 了 我好久,结果发现是 在输出This前面少了一个空格,晕死在厕所。
#include<iostream>#include<math.h>using namespace std;#define PI 3.1415926int main(){ int n; cin>>n; double x,y; double r_dou; double R_dou; int num = 1; while(n--){ cin>>x>>y; r_dou = x*x+y*y; int year = 1; R_dou = 100/PI; while(R_dou<r_dou){ year ++; R_dou = (100*year)/PI ; } cout<<"Property "<<num<<":"<<" This property will begin eroding in year "<<year<<"."<<endl; num++; } cout<<"END OF OUTPUT."<<endl; return 0;}
0 0
- POJ 1005
- POJ-1005
- POJ 1005
- poj 1005
- POJ 1005
- POJ 1005
- POJ 1005
- POJ-1005
- POJ 1005
- poj 1005
- POJ 1005
- poj 1005
- poj 1005
- POJ 1005
- poj 1005
- poj 1005
- poj 1005
- POJ-1005
- web_3个常用作用域
- Java IO的RandomAccessFile的使用
- 第三方包及异步线程
- 浅谈Web网站架构演变过程及各阶段所用的技术和架构设计
- 创建图像映射
- POJ 1005
- Linux的使用
- iOS中NSTimer的invalidate调用之后
- iOS学习笔记68-IOS移除NSAssert& NSLog
- 深入理解ORACLE启动过程
- Bubble-Notification Update
- java不定长参数
- 48 - RotateImage
- css专题学习-浏览器兼容性问题目录