提交时间:2023-08-25 08:37:03
运行 ID: 100193
#include <bits/stdc++.h> #define endl '\n' #define int long long #define MOD 100003 using namespace std; int qpow(int a, int b) { int sum = 1; while(b) { if(b%2==1)sum = sum*a%MOD; a = a*a%MOD; b/=2; } return sum; } signed main() { int m,n; cin >> m >> n; int ans = qpow(m%MOD,n); ans %= MOD; int ans2 = qpow((m-1)%MOD,n-1); ans2%=MOD; ans2*=m; ans2%=MOD; int ansf = ans-ans2+MOD; ansf%=MOD; cout << ansf << endl; return 0; }