黑佬 @ 2019-09-07 11:19:52
费马小定理求逆元出了错
#include<bits/stdc++.h>
using namespace std;
const long long mod=9901;
typedef long long ll;
ll a,b,cnt,ans;
ll ksm(ll x,ll y)
{
ll ans=1;
while(y>0)
{
if(y&1)
{
y--;
ans=(ans*x)%mod;
}
y/=2;
x=(x*x)%mod;
}
return ans%mod;
}
int main()
{
long long i,j;
scanf("%lld%lld",&a,&b);
ans=1;
for(i=2;i<=a;i++)
{
ll c=0;
while(a%i==0)
{
a/=i;
c++;
}
if(c)
ans=((ans*(ksm(i,c*b+1)-1+mod))%mod*(ksm(i,mod-2)%mod)%mod)%mod;
}
if(a!=1) ans=((ans*(ksm(a,b+1)-1+mod))%mod*(ksm(a,mod-2)%mod)%mod)%mod;
printf("%lld",ans);
return 0;
}
by 黑佬 @ 2019-09-07 11:20:09
有人吗
by 吴铭轼 @ 2019-09-07 11:24:09
有人
by NOIPer40 @ 2019-09-07 11:28:07
知道了,下一个
by Remake_ @ 2020-10-06 17:42:55
@黑佬
stO zyj