HDU 5752
Sqrt Bo
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 423 Accepted Submission(s): 188
Bo wanted to know the minimum number $y$ which satisfies $f^y(n)=1$.
note:$f^1(n)=f(n),f^y(n)=f(f^{y-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.
Each test case contains a non-negative integer $n(n<10^{100})$.
很容易发现是2^{32},所以我们先比较输入的数字是否比这个大,然后再暴力开根
- /******************************
- code by drizzle
- blog: www.cnblogs.com/hsd-/
- ^ ^ ^ ^
- O O
- ******************************/
- //#include<bits/stdc++.h>
- #include<iostream>
- #include<cstring>
- #include<cmath>
- #include<cstdio>
- #define ll long long
- #define mod 1000000007
- #define PI acos(-1.0)
- using namespace std;
- char a[];
- ll ans;
- int main()
- {
- while(scanf("%s",a)!=EOF){
- ans=;
- int len=strlen(a);
- if(len>||(len==&&a[]==''))
- printf("TAT\n");
- else
- {
- for(int i=;i<len;i++)
- ans=ans*+a[i]-'';
- int jishu=;
- while()
- {
- jishu++;
- double exm=ans;
- exm=sqrt(exm);
- ans=(ll)exm;
- if(ans==)
- break;
- }
- if(jishu<=)
- printf("%d\n",jishu);
- else
- printf("TAT\n");
- }
- }
- return ;
- }
HDU 5752的更多相关文章
- HDU 5752 Sqrt Bo (数论)
Sqrt Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...
- 【模拟】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. ...
- HDU 5752 Sqrt Bo【枚举,大水题】
Sqrt Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total S ...
- hdu 5752 Sqrt Bo 水题
Sqrt Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5752 Description Let's define the function f ...
- HDU 5752 Sqrt Bo (思维题) 2016杭电多校联合第三场
题目:传送门. 题意:一个很大的数n,最多开5次根号,问开几次根号可以得到1,如果5次还不能得到1就输出TAT. 题解:打表题,x1=1,x2=(x1+1)*(x1+1)-1,以此类推.x5是不超过l ...
- hdu 5752 Sqrt Bo
Sqrt Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total S ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
随机推荐
- nginx配置安装
先安装pcrepcre作用是让Nginx支持Rewrite功能下载地址:https://sourceforge.net/projects/pcre/files/pcre/,选择最新版本进行下载下载之后 ...
- scrapy--ipproxy
不要急于求成,你只要做的是比昨天的你更优秀一点 --匿名 今天给大家讲一下--IpProxy,由于从"http://www.xicidaili.com/nn"爬取,以下是我转载的博 ...
- 【Python 2 到 3 系列】 此整型非彼整型
v2.2 (2.x)以后,python支持不会溢出的 long 型. v3.0后,确切的讲, int 型(依赖运行环境C编译器中long型的精度)消失了,long型替代 int 型,成为新的.不依赖运 ...
- 虚拟机桥接模式下多台Ubuntu16.04系统互相连接
1.首先新建一个虚拟机并在该虚拟机上安装Ubuntu16.04系统.为这台虚拟机起名为Ubuntu3. 2.对Ubuntu3进行克隆,为新克隆生成的虚拟机起名为Ubuntu2.(这时我们会发现Ubun ...
- python-2函数
http://docs.python.org/3/library/functions.html 或者菜鸟中文资料 1-使用函数 abs(-20)#求绝对值 max(1,4,200,3,2) #求最大的 ...
- 笔记-scrapy-cookie
笔记-scrapy-cookie传递 1. scrapy cookie传递 1.1. 开始 与cookie相关的设置参数有两个: COOKIES_ENABLED 决定是否使用cooki ...
- Java石头剪刀布小游戏
package com.neusoft.test; import java.awt.BorderLayout; import java.awt.Choice; import java.awt.Colo ...
- WPF系列教程——(三)使用Win10 Edge浏览器内核 - 简书
原文:WPF系列教程--(三)使用Win10 Edge浏览器内核 - 简书 在需要显示一些 H5网站的时候自带的WebBrowser总是显示不了,WebBrowser使用的是IE内核,许多H5新特性都 ...
- 绿盟python测试实习面试
1.简历问题 低级错误:时间写错 最近好像越来越马大哈了,总是犯低级错误. 上次的开题报告首页,这次的时间,每次都有小问题,确是大毛病 到底哪里出错了 2 RHCE证书好像没有用 面试官根本就不懂这个 ...
- laravel5.5用户认证
目录 1. 命令 2. 快速认证 2.1 自定义路径 2.2 自定义用户名 2.3 自定义看守器 2.4 自定义验证/存储 2.5 Auth::xx() 2.6 保护路由 2.7 指定看守器 3 手动 ...