2017 Multi-University Training Contest 3 hdu 6063

HDU 6063

思路:

AC代码:

#include "iostream"
#include "string.h"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#pragma comment(linker, "/STACK:102400000,102400000")
#define ll long long
#define endl ("
")
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a,x) memset(a,x,sizeof(a))
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define ft (frist)
#define sd (second)
#define lrt (rt<<1)
#define rrt (rt<<1|1)
using namespace std;
const long long INF = 1e18+1LL;
const int inf = 1e9+1e8;
const int N=1e6+100;
const ll mod=1e9+7;

ll pow(ll a, ll b){
    ll ans=1;
    a%=mod;
    while(b>0){
        if(b&1){
            ans*=a;
            ans%=mod;
        }
        a*=a;
        a%=mod;
        b>>=1;
    }
    return ans;
}

int main(){
    ll n,m;
    int T=0;
    while(cin>>n>>m){
        cout<<"Case #"<<++T<<": "<<(pow(n,m)+mod)%mod<<endl;
    }
    return 0;
}
原文地址:https://www.cnblogs.com/max88888888/p/7420818.html