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 ; }

最新文章

  1. Operation not allowed after ResultSet closed--操作mysql数据库
  2. 当EL遇到char
  3. 【BZOJ3450】Tyvj1952 Easy 期望DP
  4. mysql where执行顺序
  5. 解决Xcode7.1插件安装的办法
  6. JSP起源、JSP的运行原理、JSP的执行过程
  7. codevs1024一塔湖图(丧心病狂的建图)
  8. 同时安装Xcode6和Xcode7导致出现N多UUID 模拟器解决办法
  9. VC++内置数据类型存储及取值范围
  10. Gephi——使用map of countries和Geo Layout实现包含地理坐标的数据可视化
  11. 关于阿里ICON矢量图(SVG)上传问题.
  12. CentOS系统下安装python3+Django
  13. [转载]URI、 URL 和 URN 的区别
  14. eclipse遇到启动报an error has occurred see the log file错
  15. iText框架(生成pdf文档)
  16. 移动APP开发框架盘点
  17. cocoapods 无法 升级 repo 无法执行pod install命令
  18. HDU-6395-矩阵快速幂
  19. (转)RocketMQ源码学习--消息存储篇
  20. IO流常规操作

热门文章

  1. jQuery1.11源码分析(6)-----jQuery结构总揽
  2. JS代码的加载
  3. mysql 启动 导入sql文件
  4. ThinkPHP访问不存在的模块跳到404页面
  5. L4 如何在XCode中下进行工作
  6. 【UER #1】[UOJ#12]猜数 [UOJ#13]跳蚤OS [UOJ#14]DZY Loves Graph
  7. Python socket 详解
  8. 黑客逃避追踪,为什么要用虚拟机 + TOR + VPN 呢?
  9. 【云计算】Docker集中化web界面管理平台shipyard
  10. jQuery 效果函数