题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1097
心得:
个位数相乘公共周期为4,。简单题就要一次AC!
代码:
#include <iostream>
using namespace std;
int main(){
int t[10][5]= {{0,0,0,0},{1,1,1,1},{6,2,4,8},{1,3,9,7},{6,4,6,4},
{5,5,5,5},{6,6,6,6},{1,7,9,3},{6,8,4,2},{1,9,1,9}};
int a,b;
while(cin>>a>>b)
cout<<t[a%10][b%4]<<endl;
return 0;
}