为什么会全T了呀???
查看原帖
为什么会全T了呀???
448965
杨丶老爹楼主2021/10/5 21:23

蒟蒻刚学数论,杨丽对了,但不知道为什么会超时QAQ

#include<cstdio>
#include<iostream>
#define ll long long
using namespace std;
const int mod=19260817;
ll a,b;
ll read(ll &x)
{
	ll f=1;x=0;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1,ch=getchar();}
	while(isdigit(ch)){x=x*10%mod+(ch-'0')%mod;ch=getchar();}
	x=x%mod*f;
}
ll ksm(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1) ans=(ans*x)%mod;
		x=(x*x)%mod;
		y>>=1; 
	}
	return ans%mod;
}
int main()
{
	read(a),read(b);
	if(b) printf("%lld",(a*ksm(b,mod-2)%mod)%mod);
	else cout<<"Angry!";
	return 0;
}
2021/10/5 21:23
加载中...