HDU 5752Sqrt Bo
Sqrt Bo
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 145 Accepted Submission(s): 72
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.
Each test case contains a non-negative integer n(n<10100).
233333333333333333333333333333333333333333333333333333333
import java.math.*;
import java.util.*;
public class Main{ /**
* @param args
*/
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
BigDecimal n;
BigDecimal tmp=new BigDecimal("10");
BigDecimal tmpp=new BigDecimal("0");
MathContext mc = new MathContext(1000,RoundingMode.HALF_DOWN);
int ans;
while(cin.hasNext()){
ans=-1;
n=cin.nextBigDecimal();
if(n.compareTo(tmpp)==0){
System.out.println("TAT");continue;
}
for(int j=1;j<=5;j++){
BigDecimal d = new BigDecimal(Math.sqrt(n.doubleValue()),mc);
n=d;
if(n.compareTo(tmp)<0){
if(n.intValue()==1){
ans=j;break;
}
}
}
if(ans!=-1)System.out.println(ans);
else System.out.println("TAT");
}
} }
HDU 5752Sqrt Bo的更多相关文章
- HDU 5762Teacher Bo
Teacher Bo Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tota ...
- HDU 5753Permutation Bo
Permutation Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...
- hdu Swipe Bo(bfs+状态压缩)错了多次的题
Swipe Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 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 5753 Permutation Bo (推导 or 打表找规律)
Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...
- HDU 5762 Teacher Bo (暴力)
Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
- HDU 5754 Life Winner Bo (博弈)
Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...
- HDU 5752 Sqrt Bo【枚举,大水题】
Sqrt Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total S ...
- hdu 5761 Rower Bo 物理题
Rower Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5761 Description There is a river on the Ca ...
随机推荐
- node 转二进制 图片
'use strict';const Service = require('egg').Service;const fs = require('fs');const path = require('p ...
- 使用ajax出现canceled情况
在使用ajax的时候要注意,在只定义了一个ajax请求对象的全局变量时,如果同打开发送了一个请求,但在请求还未结束时,又利用这一个全局变量发送另外一个ajax请求,就会出现某一个请求的状态码为canc ...
- oracle亲手安装过程
适用于centos6 radhat6版本 1.检查依赖库: rpm -q binutils compat-libcap1 compat-libstdc++ compat-libstdc++.i686 ...
- HTTP实验:分别使用httpd-2.2和httpd-2.4实现
1. 需求描述 1.建立httpd服务,要求: (1) 提供两个基于名称的虚拟主机: www1.stuX.com,页面文件目录为/web/vhosts/www1:错误日志为/var/log/httpd ...
- Django之初
Django之初 Django的开始: #安装Django: pip3 install django #创建Django项目: django-admin startproject 项目名 #比如: d ...
- 用python爬取一张仓鼠图片
一. 找到一张仓鼠图片并复制一下它的url url='http://img.go007.com/2017/08/16/c407f5b732f4e748_2.jpg' 二. 调用urllib库 impo ...
- PS一些技巧
色阶的解决办法 我们做效果图的时候经常会使用大面积渐变,时常会出现比较严重的色阶问题,通常出现这些明显色阶的时候,可以通过使用高斯模糊对色阶进行模糊化处理. 在使用PS CC的过程中,笔者经常遇到假死 ...
- set/multiset用法详解
集合 使用set或multiset之前,必须加入头文件<set> Set.multiset都是集合类,差别在与set中不允许有重复元素,multiset中允许有重复元素. sets和mul ...
- POJ-3692Kindergarten,求最大独立集!
Kindergarten Time Limit: 2000MS Memory Limit: 65536K Description In a kindergarten, there ar ...
- linux shell & man chmod
man chomd MBP xgqfrms-mbp:~ xgqfrms-mbp$ man chmod and entries will be removed regardless of their i ...