蒟蒻50分求助
查看原帖
蒟蒻50分求助
269085
Iceturky楼主2021/2/23 15:37
#include<cstdio>
#include<iostream>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
unsigned long long mi(int a,int b,int q)
{
	unsigned long long ans=1,temp=a;
	while(b)
	{
		if(b&1)
			ans=ans*temp%q;
		temp=temp*temp%q;
		b>>=1;
	}
	return ans%q;
}
int main()
{
	unsigned long long n,m,q=100003;
	m=read();
	n=read();
	printf("%d",(q+mi(m,n,q)-m*mi(m-1,n-1,q)%q)%q);
	return 0;
}
2021/2/23 15:37
加载中...