My issue
help me to fix the code where i’m getting wrong answer;
My code
//Radhe Radhe
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
const int M = 998244353;
ll binexp(ll a,ll b){
ll res = 1;
while(b){
if(b&1)res = ((res%M)*(a%M)%M);
a = ((a%M)*(a%M)%M);
b>>=1;
}
return res%M;
}
void Radhe(){
ll t;
cin>>t;
while(t--){
ll n,x;
cin>>n>>x;
unordered_map<ll,ll>m1;
for(ll i=2;i<=sqrtl(x);i++){
if(x%i==0){
while(x%i == 0){
x/=i;
m1[i]++;
}
}
}
if(m1[x]!=1)m1[x]++;
ll res = 0;
for(int i=1;i<=n;i++){
ll ans = 1;
for(auto x:m1){
// ans = count+1 res i - count res i
ll x1 = binexp((x.second+1),i);
ll x2 = binexp(x.second,i);
ans = ((ans % M) * ((x1 - x2 + M) % M)) % M;
ans%=M;
}
res = ((res%M) + (ans%M))%M;
}
cout<<res<<endl;
}
}
int main(){
Radhe();
// cout<<binexp(2,3);
return 0;
}
Problem Link: How many arrays Practice Coding Problem - CodeChef