给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。
Input
一个数N(1 <= N <= 10^9)
Output
输出N^N的末位数字
Input示例
13
Output示例
3
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL Del(LL a,LL b,LL c)
{
LL temp=1;
while(b>0)
{
if(b&1)
temp=temp*a%c;
b/=2;
a=a*a%c;
}
return temp;
}
int main()
{
LL n;
cin>>n;
LL sum=0;
sum=Del(n,n,10);
cout<<sum<<endl;
return 0;
}