hdu5752——Sqrt Bo(水)
来源:互联网 发布:oc第三方网络请求 编辑:程序博客网 时间:2024/05/21 09:51
Problem Description
Let’s define the function .
Bo wanted to know the minimum number which satisfies .
note:
It is a pity that Bo can only use 1 unit of time to calculate this function each time.
And Bo is impatient, he cannot stand waiting for longer than 5 units of time.
So Bo wants to know if he can solve this problem in 5 units of time.
Input
This problem has multi test cases(no more than ).
Each test case contains a non-negative integer .
Output
For each test case print a integer - the answer or a string “TAT” - Bo can’t solve this problem.
Sample Input
233
233333333333333333333333333333333333333333333333333333333
Sample Output
3
TAT
超过5次就不行,所以临界值是2^32,就输出TAT。我一开始没把2^32本身算进去,死命WA。。。
#include <iostream>#include <cstring>#include <string>#include <vector>#include <queue>#include <cstdio>#include <map>#include <cmath>#include <algorithm>#define INF 0x3f3f3f3f#define MAXN 100010#define mod 1000000007using namespace std;char s[105];int main(){ while(scanf("%s",s)==1) { if(strlen(s)>10) { printf("TAT\n"); continue; } long long num; sscanf(s,"%I64d",&num); if(num==0||num>=4294967296) { printf("TAT\n"); } else { for(long long i=0,e=2;i<=5;e=e*e,++i) { if(num<e) { printf("%I64d\n",i); break; } } } } return 0;}
0 0
- hdu5752——Sqrt Bo(水)
- hdu5752 Sqrt Bo(水)
- HDU5752 Sqrt Bo
- HDU5752 Sqrt Bo
- HDU5752 Sqrt Bo
- hdu5752 2016 Multi-University Training Contest 3 Sqrt Bo 解题报告
- hdu 5752 Sqrt Bo(水)
- HDU 5752 Sqrt Bo(水~)
- HDU-5752-Sqrt Bo-水
- hdu 5752 Sqrt Bo(2016 Multi-University Training Contest 3——水题)
- Sqrt Bo
- Sqrt Bo
- hdu 5752 Sqrt Bo (水题)
- HDU 2372 Sqrt Bo(水题)
- HDU 5752 Sqrt Bo(水题)
- hdu 5752 Sqrt Bo
- HDU 5752 Sqrt Bo
- hdu 5752 Sqrt Bo
- this和static
- js 作用域与作用域链
- MYSQL 解锁与锁表
- Linux LVM逻辑卷配置过程详解
- 并发,同步,异步,互斥,阻塞,非阻塞的理解
- hdu5752——Sqrt Bo(水)
- SKU
- 第十九章 人事与分析登陆档
- HDU1496 Equations
- 20160802 求和 找规律
- 双向循环链表的建立
- 说说C/C++中的static
- HDU 4463 Outlets
- 稀疏矩阵的创建--十字链表