#include "bits/stdc++.h" using namespace std; #define LL long long #define INF 0x3f3f3f3f3f #define PI acos(-1) #define N 510 #define MOD 10 LL quickPow(LL a,LL b) { LL ans=1; while(b>0){ if(b&1){ ans=ans*a%MOD; } b>>=1; a=a*a%MOD; } return ans; } int main() { int n,k; while(~scanf("%d",&n)){ printf("%lld\n",quickPow(n,n)); } return 0; }
时间: 2024-10-20 05:56:34