已知a和b,求出a^b的个位数。
输入包含多组测试用例。
每组测试用例,包含两个数组a和b(0<a,b<=2^30)。
对于每组测试用例,你需要输出a^b的个位数。
9 6
#include <iostream>
#include <cstring>
int man()
{
int ans[10][5]={
{ 0, 0, 0 ,0, 0},
{ 1, 1, 1, 1, 1},
{ 6, 2, 4, 8, 6},
{ 1, 3, 9, 7, 1},
{ 6, 4, 6, 4, 6},
{ 5, 5, 5, 5, 5},
{ 6, 6, 6, 6, 6},
{ 1, 7, 9, 3, 1},
{ 6, 8, 4, 2, 6},
{ 1, 9, 1, 9, 1}
};
unsigned long a, b;
while (std::cin>>a>>b)
{
std::cout << ans[a%10][b%4] << std::endl;
}//std::cout << "Hello, World!" << std::endl;
return 0;
}