标签:
Description
In the first case, 3 * 3 * 3 = 27, so the rightmost digit is 7. In the second case, 4 * 4 * 4 * 4 = 256, so the rightmost digit is 6.
1 #include<cstdio> 2 int main() 3 { 4 __int64 t,l,b; 5 scanf("%I64d",&t); 6 while(t--) 7 { 8 __int64 n; 9 scanf("%I64d",&n); 10 l=n%100; 11 b=l; 12 for(__int64 i=1;i<l;i++) 13 { 14 b=b*l; 15 b%=100; 16 } 17 b%=10; 18 printf("%I64d\n",b); 19 } 20 }
标签:
原文地址:http://www.cnblogs.com/yexiaozi/p/5696248.html