略微有些凌乱,加了微量注释(
#include<bits/stdc++.h>
using namespace std;
//#define int short
#define mo(a) a%=998244353
int n,m;
int w[10005];
int t[10005][10005];//第i个质数作为第j个数的因数的贡献
int mx;
bool vis[10005];
int p[10005],tot;
int id[10005];
void init(){/质数筛
vis[1]=1;
for(int i=2;i<=mx;i++){
if(!vis[i]) p[++tot]=i;
for(int j=1;p[j]*i<=mx;j++){
vis[p[j]*i]=1;
}
}
return;
}
int orin[10005];
signed main(){
// freopen("plant3.in","r",stdin);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>w[i];
orin[i]=w[i];
mx=max(mx,w[i]);
}
// cout<<">>"<<mx<<endl;
init();
// for(int i=1;i<=tot;i++) cout<<p[i]<<" ";cout<<endl;
long long ans=1;
for(int i=1;i<=n;i++){
for(int j=1;j<=tot;j++){
t[j][i]=1;
// if(p[j]>w[i]/2) break;
if(w[i]%p[j]==0) t[j][0]++;
while(w[i]%p[j]==0){
// cntson++;
t[j][i]++,w[i]/=p[j];
}
// ans*=(cntson+1);mo(ans);
}
}//筛出所有质因数
for(int i=tot;i;i--){
// if(p[i]>m) break;
while(m%p[i]==0){
t[i][n+1]++,m/=p[i];
}//找出质因数在m中的贡献
sort(t[i]+1,t[i]+1+n);
for(int j=1;j<=n,t[i][n+1]!=0;j++){
t[i][j]++,t[i][n+1]--;
if(t[i][j]<=t[i][j+1]||j==n) j=1;
}
//加到贡献最小的数里
}
for(int i=1;i<=n;i++){
for(int j=1;j<=tot;j++){
// if(p[j]>orin[i]) break;
ans*=t[j][i];mo(ans);
}//累计答案
}
// for(int i=0;i<=n+1;i++){
// cout<<i<<":";
// for(int j=1;j<=5;j++){
// cout<<t[p[j]][i]<<" ";
// }cout<<endl;
// }
cout<<ans<<endl;
}
//(3+1)*(1+1)*(1+1)
//(5+1)*(2+1)
//(1+1)*(3+1)
//8:1 2 4 8 ->2^3;
//243:1 3 9 27 81 243 ->3^5;5+1
//250:1 2 5 10 25 50 125 250 ->2^1*5^3;(1+1)*(3+1)
//60:1 2 3 4 5 6 10 12 15 20 30 60 ->2^2*3^1*5^1;3*2*2