Uva 107 The Cat in the Hat
来源:互联网 发布:歌手王芳 知乎 编辑:程序博客网 时间:2024/05/23 18:31
#include<iostream>#include<cstdio>#include<string>#include<map>#include<algorithm>#include<vector>#include<queue>#include<set>#include<cstring>#include<stack>#include<cmath>#define ep 1e-9using namespace std;int main(){int init_height,worker;while(scanf("%d %d",&init_height,&worker)){if(init_height==0&&worker==0)break;int i,j;int exponent;double temp;for(exponent=0;exponent<100;exponent++){temp=pow(pow(worker,1.0/exponent)+1.0,exponent*1.0);if(fabs(temp-init_height)<ep)break;}int N=pow(worker*1.0,1.0/exponent)+ep;int sum_height=0;int amount=0;for(i=0;i<exponent;i++){sum_height=sum_height+init_height*(pow(N*1.0,i)+ep)+ep;amount=amount+pow(N*1.0,i)+ep;init_height=ceil(init_height*1.0/(N+1));}sum_height+=pow(N*1.0,exponent)+ep;printf("%d %d\n",amount,sum_height);}return 0;}
0 0
- uva 107 The Cat in the Hat
- uva 107 the cat in the hat
- uva 107 - The Cat in the Hat
- UVa 107 - The Cat in the Hat
- UVA 107 - The Cat in the Hat
- UVa 107 - The Cat in the Hat
- UVA 107 The Cat in the Hat
- uva 107 - The Cat in the Hat
- uva 107 The Cat in the Hat
- UVA 107 The Cat in the Hat
- uva 107 - The Cat in the Hat
- UVa 107 - The Cat in the Hat
- UVa - 107 - The Cat in the Hat
- UVa 107 - The Cat in the Hat
- UVA 107 The Cat in the Hat
- Uva 107 The Cat in the Hat
- UVA - 107 The Cat in the Hat
- UVa 107 The Cat in the Hat
- 《java入门第一季》之UDP协议下的网络编程小案例
- MyBatis中的数据库动态查询的编写
- hive2.0版本整合hbase1.2.1
- EM算法
- UI高级之UIWindow
- Uva 107 The Cat in the Hat
- char (* pb)[4] 和 char * pb[4] 的区别(为了避免误导,这里欢迎讨论,不要作为定论!!个人见解,可能会有错误)
- python datetime 时间日期处理
- Android事件分发总结
- UI高级-UIApplication单例
- 洛谷 U2878 小R的分数比赛(fraction)
- 图像的均值滤波和方框滤波
- 二叉搜索树的性质
- poj 1172 Street Race