rt,想知道为啥。code:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
int Q,x,y,n;
inline int read(){
int x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=x*10+c-'0';
c=getchar();
}
return x*f;
}
inline int quickpow(int a,int b){
int res=1;
while(b>0){
if(b%2==0)(a*=a)%=mod,b/=2;
else (res*=a)%=mod,b--;
}
return res%mod;
}
signed main(){
Q=read();
while(Q--){
x=read(),y=read(),n=read();
int t=y/x,ans=1;
// cout<<t<<"\n";
for(int i=2;i<=t;i++){
int k=0,temp;
while(t%i==0&&t>0)k++,t/=i;
if(k!=0){
// cout<<i<<"有"<<k<<"个\n";
(temp+=quickpow(k+1,n))%=mod;
(temp-=quickpow(k,n))%=mod;
(temp-=quickpow(k,n))%=mod;
(temp+=quickpow(k-1,n))%=mod;
(temp+=mod)%=mod;
(ans*=temp)%=mod;
}
}
cout<<(ans+mod)%mod<<'\n';
}
return 0;
}
对于 xy 分解质因数,每个质因数单独计算贡献(可能是一些很唐的错误,帮忙看看