zoukankan      html  css  js  c++  java
  • hdu 5752 Sqrt Bo

    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(fy1(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="4294967296";
        string s5="65536";
        string s4="256";
        string s3="16";
        string s2="4";
        string s1="2";
        string a;
        while(cin>>a)
        {
            if((a.length()==s6.length()&&a>=s6)||(a.length()>s6.length()))
            {
                printf("TAT
    ");
            }
            else if((a.length()==s5.length()&&a>=s5)||(a.length()>s5.length())){printf("5
    ");}
            else if((a.length()==s4.length()&&a>=s4)||(a.length()>s4.length())){printf("4
    ");}
            else if((a.length()==s3.length()&&a>=s3)||(a.length()>s3.length())){printf("3
    ");}
            else if((a.length()==s2.length()&&a>=s2)||(a.length()>s2.length())){printf("2
    ");}
            else if((a.length()==s1.length()&&a>=s1)||(a.length()>s1.length())){printf("1
    ");}
            else if(a=="1") printf("0
    ");
            else if(a=="0") printf("TAT
    ");
        }
        return 0;
    
    
    }
    View Code
  • 相关阅读:
    source : not found 原因及解决办法
    hdfs 数据坏块导致datanode不能正常上报数据块
    hadoop 基准测试
    Linux yum 安装mysql的时候指定安装版本
    如何从头构建一个只有bash的镜像
    创建自己的基础镜像
    go学习(2)变量
    Go学习(1)go安装
    spark on yarn 错误
    mysqld: File './mysql-bin.index' not found (Errcode: 13
  • 原文地址:https://www.cnblogs.com/superxuezhazha/p/5722464.html
Copyright © 2011-2022 走看看