十个测试点,只能过前4个不知道哪里有问题,求大佬指点
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.TreeSet;
public class Main
{
static boolean[] st=new boolean[120];
static int mod=998244353;
public static void main(String[] args) throws IOException
{
Scanner scan = new Scanner(System.in);
long L=scan.nextLong();
long R=scan.nextLong();
int x= (int) Math.sqrt(L);
int y= (int) Math.sqrt(R);
st[0]=st[1]=true;
for(int i=2;i<=110;i++)//朴素法筛质数,false为质数
{
if(st[i]) continue;
for(int j=i+i;j<=110;j+=i)
{
st[j]=true;//被筛掉
}
}
boolean flag=false;
long v=1;
for(int i=x;i<=y;i++)
{
if(i*i<L)
{
continue;
}
int ans = get_sum(i * i);//得到数的每位之和
if(!st[ans])
{
v=((v)%mod)*((i*i)%mod)%mod;
flag=true;
}
}
if(!flag)
{
System.out.println("0");
}
else
{
System.out.println(v);
}
}
static int get_sum(long x)
{
int res=0;
while(x!=0)
{
res+=x%10;
x/=10;
}
return res;
}
}