POJ-1005
2015-07-11 00:52
344 查看
#include<iostream> #include<cmath> //#include<algorithm> using namespace std; #define PI 3.1415926 /* return: years */ int recursionFunc(float rCurrent, float xYMin){ float r; if(rCurrent==0){ r=sqrt(100.0/PI); }else{ r=sqrt(100.0/PI+pow(rCurrent,2)); } if(r>xYMin){ return 1; }else{ return 1+recursionFunc(r, xYMin); } } int main(int argc, char *argv[]){ int n; float x,y; float r; cin>>n; for(int i=0;i<n;i++){ cin>>x>>y; r=sqrt(pow(x,2)+pow(y,2)); cout<<"Property "<<i+1<<": This property will begin eroding in year "<<recursionFunc(0,r)<<"."<<endl; } cout<<"END OF OUTPUT."<<endl; return 0; }
相关文章推荐
- 转存
- 【代码片段】两列布局
- JavaScript Lexical Scope
- 加性高斯白噪声信道(AWGN)下的digital调制格式识别分类
- 【LeetCode】Linked List Cycle I&II
- android回调函数
- 员工管理
- c语言学习之数组3
- 暴力拆解hupu球员信息
- Python 3.4 install lxml
- poj1067-取石子游戏 (威佐夫博弈)
- 【只需3步】Linux php的安装与配置[源码安装]
- 【只需3步】Linux php的安装与配置[源码安装]
- Android突击:PanelLayout的实现
- APIDemo动画合集
- POJ 2481 Cows
- tomcat 配置
- css学习笔记之 inline-block
- 二叉树中序遍历(迭代)
- 为InfiniBand而哭泣