Sqrt Bo

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 980    Accepted Submission(s): 452

Problem Description
Let's define the function f(n)=⌊n√⌋.

Bo wanted to know the minimum number y which satisfies fy(n)=1.

note:f1(n)=f(n),fy(n)=f(fy−1(n))

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 120).

Each test case contains a non-negative integer n(n<10100).

 
Output
For each test case print a integer - the answer y or a string "TAT" - Bo can't solve this problem.
 
Sample Input
233
233333333333333333333333333333333333333333333333333333333
 
Sample Output
3
TAT
 
Author
绍兴一中
 
Source
 
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
using namespace std;
int main()
{ string s6="";
string s5="";
string s4="";
string s3="";
string s2="";
string s1="";
string a;
while(cin>>a)
{
if((a.length()==s6.length()&&a>=s6)||(a.length()>s6.length()))
{
printf("TAT\n");
}
else if((a.length()==s5.length()&&a>=s5)||(a.length()>s5.length())){printf("5\n");}
else if((a.length()==s4.length()&&a>=s4)||(a.length()>s4.length())){printf("4\n");}
else if((a.length()==s3.length()&&a>=s3)||(a.length()>s3.length())){printf("3\n");}
else if((a.length()==s2.length()&&a>=s2)||(a.length()>s2.length())){printf("2\n");}
else if((a.length()==s1.length()&&a>=s1)||(a.length()>s1.length())){printf("1\n");}
else if(a=="") printf("0\n");
else if(a=="") printf("TAT\n");
}
return ; }

hdu 5752 Sqrt Bo的更多相关文章

  1. HDU 5752 Sqrt Bo (数论)

    Sqrt Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...

  2. HDU 5752 Sqrt Bo【枚举,大水题】

    Sqrt Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total S ...

  3. hdu 5752 Sqrt Bo 水题

    Sqrt Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...

  4. 【模拟】HDU 5752 Sqrt Bo

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 题目大意: 定义f(n)=⌊√n⌋,fy(n)=f(fy-1(n)),求y使得fy(n)=1. ...

  5. HDU 5752 Sqrt Bo (思维题) 2016杭电多校联合第三场

    题目:传送门. 题意:一个很大的数n,最多开5次根号,问开几次根号可以得到1,如果5次还不能得到1就输出TAT. 题解:打表题,x1=1,x2=(x1+1)*(x1+1)-1,以此类推.x5是不超过l ...

  6. HDU 5752

    Sqrt Bo Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total S ...

  7. HDU 5761 Rower Bo

    传送门 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Special Jud ...

  8. HDU 5753 Permutation Bo (推导 or 打表找规律)

    Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...

  9. HDU 5762 Teacher Bo (暴力)

    Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...

随机推荐

  1. sql拷贝表结构不拷贝表数据

  2. 通用js类库

    /* 其它通用函数 */$(function() { // var General = function() { var _self = this; /* 写 cookie 操作 */ _self.S ...

  3. Arbitrage(bellman_ford)

    Arbitrage Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16652   Accepted: 7004 Descri ...

  4. Windows下Cygwin添加右键菜单

    在http://herry2013git.blog.163.com/blog/static/2195680112013437139447/看到一篇文章,将Cypwin加入右键菜单,方便使用. 为了更傻 ...

  5. IOS项目删除Git

    默认创建工程会在MAC上面创建Git版本管理, 但是呢, 我现在想上传到svn服务器进行管理, 但是已经有个git 好像上传不了 只有把Git删了才能继续. 连问带查, 终于找到解决方案 把 .git ...

  6. AspectJ报错:error at ::0 can't find referenced pointcut XXX

    今天在使用AspectJ进行注解切面时,遇到了一个错误. 切点表达式就是无法识别——详细报错信息如下: Exception in thread "main" org.springf ...

  7. 在Windows Server 2012 中安装 .NET 3.5 Framework

    问题 如今,仍然有许多程序和应用需要依靠.NET 3.5 framework 来运行.在Windows Server 2012中,微软提供了.NET 3.5 和.NET 4.5的安装选项以为你的应用程 ...

  8. Lucas的数论题解

    Lucas的数论 reference 题目在这里> < Pre 数论分块 默认向下取整时. 形如\(\sum\limits_{i=1}^n f\left( \frac{n}{i}\righ ...

  9. Linux&shell之高级Shell脚本编程-创建函数

    写在前面:案例.常用.归类.解释说明.(By Jim) 使用函数 #!/bin/bash # testing the script function myfun { echo "This i ...

  10. AWS AutoScaling

    origin_from: http://blog.csdn.net/libing_thinking/article/details/48327189 AutoScaling 是 AWS 比较核心的一个 ...