HDOJ1061:Rightmost Digit——简单数学题

Problem Description
Given a positive integer N, you should output the most right digit of N^N.

The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains a single positive integer N(1 #include using namespace std; int main(){ int n,m; int a[10][4] = {{0,0,0,0},{1,1,1,1},{2,4,8,6},{3,9,7,1},{4,6,4,6},{5,5,5,5},{6,6,6,6},{7,9,3,1},{8,4,2,6},{9,1,9,1}}; cin>>m; while(m–) cin>>n,cout=0?n%4-1:3]