标签:
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 using namespace std; 5 int main() 6 { 7 8 int n; 9 int x; 10 scanf("%d",&n); 11 while(n--) 12 { 13 scanf("%d",&x); 14 int m=x%10; 15 int num=1; 16 if(m==0||m==1||m==5||m==6||m==9) 17 { 18 cout<<m<<endl; 19 } 20 else 21 { 22 while(x>0) 23 { 24 if(x%2==1) 25 { 26 num*=m; 27 num%=10; 28 } 29 x/=2; 30 m*=m; 31 m%=10; 32 } 33 cout<<num<<endl; 34 } 35 } 36 }
标签:
原文地址:http://www.cnblogs.com/guofeng1022/p/4246340.html