Problem:
-
Total time limit:
-
1000ms
-
Memory Limit:
-
65536kB
-
-
Describe
-
A
-
positive integer n with a maximum length of 200 bits is known, and the latter four bits of the 2011^n are requested.
-
-
Input
-
-
The first behavior is a positive integer k, which represents the K-group data, k<=200 the next K-line,
Each row has a positive integer n,n number of digits <=200
-
-
Output
-
-
the result of each n is a single integer row, if less than 4 bits, the removal of high-level redundant 0
-
-
Sample input
-
-
3528792
-
-
Sample output
-
-
1051815521
Solution:
#include<iostream>#include<string>using namespaceStd;int Main(){intN;Cin>>N;string J; for(intI=0;I<N;I++){Cin>>J;intJj;//int jj= (j[j.length () -1]-48) *1+ (J[j.length () -2]-48) *10+ (J[j.length () -3]-48) *100;if (J.size() <3)J=" A"+J; {J=J.substr((int)J.size()-3,3);Jj=(J[0]- -)* -+(J[2]- -)+Ten*J[1]-480;}intR= .;if(Jj% -==0){cout<<1<<Endl;Continue;}intU=Jj% -; while(U>1){R*= .;R%=10000;U--;}cout<<R<<Endl;}return 0;}
Openjudge Exercise Solution (c + +)--Question 4,010:2011