HDU1061
规律题
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 /* 2 n^n 个位 3 */ 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 #include<iostream> 8 #include<algorithm> 9 #include<queue> 10 #include<map> 11 #include<math.h> 12 using namespace std; 13 const int maxn = 1005; 14 const int inf = 0x7fffffff; 15 int main(){ 16 int T; 17 scanf("%d",&T); 18 while( T-- ){ 19 int n; 20 scanf("%d",&n); 21 int cir; 22 if( n%4==0 ) cir=4; 23 else cir=n%4; 24 n%=10; 25 int tmp=1; 26 while( cir-- ){ 27 tmp*=n; 28 } 29 printf("%d\n",tmp%10); 30 } 31 return 0; 32 }
keep moving...