快速幂

    xiaoxiao2021-03-25  244

    #include<cstdio> #include<iostream> using namespace std; #define LL long long int Max=100; LL fun(LL x,LL n) { LL res=1; while(n>0) { if(n&1) res=(res*x)%Max; x=(x*x)%Max; n>>=1; } return res; } int main() { LL x,n; while(scanf("%lld %lld",&x,&n)!=EOF) { LL ans=fun(x,n); printf("%lld\n",ans); } return 0; }
    转载请注明原文地址: https://ju.6miu.com/read-1095.html

    最新回复(0)