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. Borg Maze(MST & bfs)

    Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9220   Accepted: 3087 Descrip ...

  2. (11)UI布局和分辨率适配

    一.Cocos编辑器 自动布局系统主要涉及固定与拉伸属性:   如图,总共可以修改控件的上下左右四个图钉和中间的两个拉伸条六个属性. 效果   1.当打开其中的任意一个图钉时,当前节点与父节点的对应边 ...

  3. 初学require.js

    引入require.js,可以解决的问题: (1)实现js文件的异步加载,避免网页失去响应: (2)管理模板之间的依赖性,便于代码的编写和维护. 它的模块管理遵循AMD规范(Asynchronous ...

  4. ruby的in?方法

    (文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) $ irbirb(main):001:0> a = 1=> 1irb(main):002 ...

  5. jquery.fileupload.js 杂记

    通过$your_jq_dom.fileupload({},donf:function...,fail:function..., ...) 得到的只是一个支持上传的控件,当然绑定了各种事件. 传参给ur ...

  6. Balanced Teams (USACO Jan Bronze 2014)

    既然是bronze,毫无压力的AC了. 就是个深搜,当然加个剪枝--最后一个组不用搜. 恩可以一个一个组分层次dfs,这样会跑得飞起~~也不容易错 #include <cstdio> in ...

  7. android文章学习 侧滑菜单实现

    http://blog.csdn.net/jj120522/article/details/8075249 http://blog.csdn.net/lilybaobei/article/detail ...

  8. FileOutputStream与FileInputStream互相转换

    List<InstorageNoticeDto> noticeList = null; FileOutputStream fos = null; FileInputStream is = ...

  9. 转数据库Sharding的基本思想和切分策略

    本文着重介绍sharding的基本思想和理论上的切分策略,关于更加细致的实施策略和参考事例请参考我的另一篇博文:数据库分库分表(sharding)系列(一) 拆分实施策略和示例演示 一.基本思想 Sh ...

  10. Python——内置类型

    Python定义了丰富的数据类型,包括: 数值型:int, float, complex 序列:(iterable) str, unicode, tuple, list, bytearray, buf ...