people see people love a^b
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 34306 Accepted Submission (s): 23290
problem DescriptionAn integer representing the last three digits of the a^b. Description: The meaning of A^b is "A's B-square" InputThe input data contains multiple test instances, one row per instance, consisting of two positive integers a and B (1<=a,b<=10000), and if a=0, b=0, indicates the end of the input data and does not process. Outputfor each test instance, output an integer representing the last three bits of a^b, one row for each output. Sample Input2 366789 100000 0 Sample Output89841basic knowledge of elementary number theory, taking surplus
1#include <iostream>2 using namespacestd;3 intMain ()4 {5 intA, B;6 while(Cin >> a >>b)7 {8 if(A = =0&& b = =0)9 Break;Ten intsum =1; One for(inti =0; I < b; i++) A { -sum = SUM *A; - if(Sum > +) theSum%= +; - } -cout << sum <<Endl; - } + return 0; -}
View Code
Hdu 2035 people see people love a^b