poj 1289 The Cat in the Hat
来源:互联网 发布:mac 计时钟表 编辑:程序博客网 时间:2024/04/30 11:11
大水题一道。
#include<cstdio>#include<cstring>#include<iostream>using namespace std;int main(void){ int a,b; while(1) { scanf("%d %d",&a,&b); if(a==0&&b==0) break; int t1,t2,n = 0; bool flag = true; while(flag) { ++n; t1 = t2 = 1; while(t1<a) { t1 *= (n+1); t2 *= n; } if(t1==a&&t2==b) { flag = false; break; } } int ans1, ans2 = 0; if(n==1) { ans1 = 0; } else { ans1 = (b-1)/(n-1) ; } int tmp1,tmp2 = b; tmp1 = 1; for(;;) { ans2 += tmp1*tmp2; if(tmp2==1) break; tmp1 *= n+1; tmp2 /= n; } cout<<ans1<<" "<<ans2<<endl; } return 0;}
- poj 1289 The Cat in the Hat
- [POJ 1289] The Cat in the Hat · 数学
- POJ 1289 The Cat in the Hat 笔记
- The Cat in the Hat
- The Cat in the Hat
- The Cat in the Hat
- The Cat in the Hat
- The Cat in the Hat
- The Cat in the Hat
- The Cat in the Hat
- poj1289 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
- 107 - The Cat in the Hat
- UVA 107 - The Cat in the Hat
- UVa 107 - The Cat in the Hat
- Exercise 3.3 E7
- Windows 反调试参考翻译1
- C语言-字符串的定义与初始化
- xml 树状显示
- Windows 反调试参考翻译2
- poj 1289 The Cat in the Hat
- 字符串补充-字符串的\0
- 需要判断字符串中是否含有双引号
- listView 动态设置高亮
- Oracle控制文件操作
- json-lib 之jsonConfig详细使用
- C语言-switch
- HTML5,GIS不再是栅格切片图片
- 研究人员涉足关键问题:厌恶者倾向于厌恶吗?(Researchers take on crucial question: Are haters gonna hate ?)