1005 I Think I Need a Houseboat
2016-06-11 11:11
344 查看
#include<iostream> #include<cmath> #include<string> #include<vector> #define pi 3.1415926 using namespace std; int house(double r){ double squre=0; int year=0; while((r*r*pi/2)>squre){ squre+=50; year++; } return year; } int main(){ int n; cin>>n; vector<int> result; for(int i=0;i<n;i++){ double x; double y; double r; cin>>x; cin>>y; r=pow(x*x+y*y,1.0/2.0); int n = house(r); result.push_back(n); } int index =1; vector<int>::iterator it; for(it=result.begin();it!=result.end();++it){ cout<<"Property "<<index++<<": This property will begin eroding in year "<<*it<<"."<<endl; } cout<<"END OF OUTPUT."<<endl; return 0; }
相关文章推荐
- Geekband C++面向对象高级编程(下) 第二周笔记 暗影行者
- 【机器学习实战】-01KNN近邻算法
- Kettle_使用Pan.bat执行转换、Kitchen.bat执行作业
- 1003 Hangover
- 宏定义中的# ## @# \
- 实现MaterialDesign的EditText
- Reverse Bits
- HDOJ 2073 无限的路
- Java千百问_01基本概念(011)_JavaApplet是什么
- 《程序员修炼之道--从小工到专家》阅读笔记03
- jquery对所有<input type="text"的控件赋值
- 未雨绸缪,聊聊旧系统升级改造那些事儿
- 1007 DNA Sorting
- 代码GG 公众号
- 第十六周上机时间项目——项目1—小玩文件2
- E The Binding of Isaac
- LeetCode(8) String To Integer(atoi)
- 学习笔记之MySQL
- 函数指针,指针数组和数组指针
- 51nod 1459 迷宫游戏