题目在这里
代码:
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
int a[10000010],cnt;
bool check(int x){
if(x<2) return false;
for(int i=2;i*i<=x;i++){
if(x%i==0){
return false;
}
}
return true;
}
signed main(){
int l,r;
cin>>l>>r;
for(int i=1;i*i<=1e12;i++){
int x=i*i;
int sum=0;
while(x>0){
sum+=x%10;
x/=10;
}
if(check(sum)){
a[++cnt]=i*i;
}
}
int ans=1;
for(int i=1;i<=cnt;i++){
if(a[i]>=l&&a[i]<=r){
ans=(ans*a[i])%mod;
}
}
if(ans==1){
cout<<0<<endl;
}
else cout<<ans<<endl;
return 0;
}