提交时间:2023-08-25 10:51:41

运行 ID: 100291

#include<bits/stdc++.h> using namespace std; int n, m; const int mo = 100003; int p(int a,int b) { int ans = 1; while(b != 0) { if(b & 1 == 1) { ans *= a; ans %= mo; } b /= 2; a = ((a % mo) * (a % mo)) % mo; } return ans; } int main(){ cin >> m >> n; cout << ((p(m, n) % mo - (m * p(m - 1, n - 1))) % mo + mo ) % mo; return 0; }