洛谷 P3197 [HNOI2008]越狱
越狱
(咕咕咕)
Code:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
//Mystery_Sky
//
#define M 1000100
#define ll long long
#define Mod 100003
ll n, m;
ll quickPow(ll x, ll k)
{
ll ret = 1;
while(k) {
if(k & 1) ret = (ret * x) % Mod;
k >>= 1;
x = (x * x) % Mod;
}
return ret % Mod;
}
int main() {
scanf("%lld%lld", &m, &n);
printf("%lld\n", (quickPow(m, n) - (m * quickPow(m-1, n-1)) % Mod + Mod) % Mod);
return 0;
}
唯愿,青春不辜负梦想,未来星辰闪耀