HDU2056

/*
 * 指数型母函数
 */
#include<cstdio>
#define mod 100
typedef long long LL;//杭电需用int64

int powerMod(int a,LL b){
    LL ans=1;
    while(b){
        if(b%2){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans%mod;
}
int main(){
    int t;
    while(scanf("%d",&t)&&t){
        for(int i=0;i<t;i++){
            LL n;
            scanf("%lld",&n);
            printf("Case %d: %d ",i+1,(powerMod(4,n-1)+powerMod(2,n-1))%mod);
        }
        puts("");
    }
}

原文地址:https://www.cnblogs.com/Stomach-ache/p/3703234.html