链接:
#include <stdio.h>
int main()
{
puts("转载请注明出处[vmurder]谢谢");
puts("网址:blog.csdn.net/vmurder/article/details/44573697");
}
题解:
全集是 mn ,然后补集是第一个随便选,其后每个点有m-1种选法,是 m∗(m−1)n−1
代码:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mod 100003
using namespace std;
long long n,m;
long long power(long long x,long long p)
{
long long ans=1;
while(p)
{
if(p&1)ans=ans*x%mod;
x=x*x%mod,p>>=1;
}
return ans;
}
int main()
{
cin>>n>>m;
cout<<(power(n,m)+mod-power(n-1,m-1)*n%mod)%mod<<endl;
}