标签:class space bsp ace quick include while end int
#include<iostream> using namespace std; long long quick(long long a,long long b,int c) { int ans=1; a=a%c; while(b!=0) { if(b&1) ans=(ans*a)%c; b>>=1; a=(a*a)%c; } return ans; } int main() { long long a,b; while(cin>>a>>b) { cout<<quick(a,b,10)<<endl; } return 0; }
标签:class space bsp ace quick include while end int
原文地址:https://www.cnblogs.com/HadesBlog/p/9629637.html