0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:56:27 +00:00

1008. [HNOI2008]越狱

https://darkbzoj.cc/submission/191426
This commit is contained in:
Baoshuo Ren 2022-05-11 17:21:19 +08:00
parent f368b6b67b
commit 56435b1c0a
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

25
BZOJ/1008/1008.cpp Normal file
View File

@ -0,0 +1,25 @@
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
const int mod = 100003;
long long binpow(long long a, long long b) {
a %= mod;
long long res = 1;
while (b > 0) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
int main() {
long long m, n;
cin >> m >> n;
cout << (binpow(m, n) - binpow(m - 1, n - 1) * m % mod + mod) % mod << endl;
return 0;
}