Gao_l @ 2023-07-20 21:40:02
#include<bits/stdc++.h>
using namespace std;
const int mod=9901;
int a,b,sa,n[10005][2],cot=0,ans=1;
int pw(int ml,int nl){
int s=1;
while(nl){
if(nl%2==1){
s=(s%mod)*(ml%mod)%mod;
}
ml=ml*ml%mod;
nl=nl>>1;
}
return s%mod;
}
int sum(int x,int y){
int k=0;
y*=b;
if(x%mod==1){
k=(y+1)%mod;
}else{
k=(pw(x%mod,y+1)-1)%mod*pw((x-1)%mod,mod-2)%mod;
}
return k%mod;
}
int main(){
cin >> a >> b;
if(!a){
cout << "0";
return 0;
}
for(int i=2;i*i<=a;i++){
if(!a%i){
cot++;
n[cot][0]=i;
n[cot][1]=1;
a/=i;
while(a%i==0){
n[cot][1]++;
a=a/i;
}
}
}
if(a!=1){
cot++;
n[cot][0]=a;
n[cot][1]=1;
}
for(int i=1;i<=cot;i++){
ans=ans*sum(n[i][0],n[i][1])%mod;
}
cout << (ans%mod+mod)%mod;
}
by Sad_Rex @ 2023-07-20 22:24:02
@Gao_l 你要把第34行的
!a%i
改成!(a%i)
即可AC
by Sad_Rex @ 2023-07-20 22:24:29
!的优先级更高
by Sad_Rex @ 2023-07-20 22:24:41
QwQ
by Sad_Rex @ 2023-07-20 22:25:36
如果Rex帮到你了请关注我ou喵~~
by Sad_Rex @ 2023-07-20 22:25:41
@Gao_l
by Gao_l @ 2023-07-21 08:03:03
6