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 Descriptionlet ' s define the functionf(n)=⌊n√⌋ .
Bo wanted to know the minimum numberywhich satisfiesfy(n)=1 .
NoteF1(N)=F(N),fy(n)=F(fy−1(n))
It is a pity, so 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.
Inputthis problem have multi test cases (no more than).
Each test case contains a non-negative integer n(n<ten) /c12>.
Outputfor each test case print a integer-the answer y or a string "TAT"-Bo can ' t solve this problem.
Sample Input233233333333333333333333333333333333333333333333333333333333
Sample Output3tat
Author Shaoxing one middle
Source2016 multi-university Training Contest 3
#include <iostream>#include<stdio.h>#include<math.h>#include<string>#include<string.h>using namespacestd;intMain () {strings6="4294967296"; strings5="65536"; strings4=" the"; strings3=" -"; stringS2="4"; strings1="2"; stringA; 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=="1") printf ("0\n"); Else if(a=="0") printf ("tat\n"); } return 0;}
View Code
HDU 5752 Sqrt Bo