HDU 5752 Sqrt Bo (thinking problem) 2016 Hangzhou Electric Multi-school joint third Field

Source: Internet
Author: User

Title: Portal.

Test instructions: A large number of N, up to 5 times the root of the root, ask several square root can get 1, if 5 times can not get 1 on the output tat.

Problem solving:x1=1,x2= (x1+1) * (x1+1)-1, etc. X5 is not more than a long long , the output can be judged.

#include <iostream>#include<cstdio>#include<cstring>#include<cmath>using namespaceStd;typedefLong Longll;Charc[1005];intMain () { while(cin>>c) {intlen=strlen (c); if(len>= the) {printf ("tat\n"); }        Else{ll n=c[0]-'0'; LL Maxx=4294967295;  for(intI=1; i<len;i++) n=n*Ten+c[i]-'0'; if(n==0) printf ("tat\n"); Else if(n==1) printf ("0\n"); Else if(n<=3) printf ("1\n"); Else if(n<= the) printf ("2\n"); Else if(n<=255) printf ("3\n"); Else if(n<=65535) printf ("4\n"); Else if(n<=Maxx) printf ("5\n"); Elseprintf ("tat\n"); }    }    return 0;}

HDU 5752 Sqrt Bo (thinking problem) 2016 Hangzhou Electric Multi-school joint third Field

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.