全RE求助!
查看原帖
全RE求助!
937985
Teamo_me楼主2023/9/15 16:41
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=520;
int a[N];
ll l,r;
ll ans=1;
ll cl(ll x){
	if(x/10==0) return 1;
	if(x/100==0||x==10) return 10;
	if(x/1000==0||x==100) return 100;
	if(x/10000==0||x==1000) return 1000;
	if(x/100000==0||x==10000) return 10000;
	if(x/1000000==0||x==100000) return 100000;
	if(x/10000000==0||x==1000000) return 1000000;
	if(x/100000000==0||x==10000000) return 10000000;
	if(x/1000000000==0||x==100000000) return 100000000;
	if(x/10000000000==0||x==1000000000) return 1000000000;
	if(x/100000000000==0||x==10000000000) return 10000000000;
	if(x/1000000000000==0||x==100000000000) return 100000000000;
	if(x/10000000000000==0||x==1000000000000) return 1000000000000;
}//用于求出是几位数的函数 
ll hz(ll x){ 
    int m=cl(x);
	if(m==1) return 1;
	int i=1;   
    while(1){
	    if(x==0)
    	break;
    	a[i]=x/m;
    	i++;
    	x=x-(x/m*cl(x));
    	m=cl(x);
	}
	int s=0;
	for(int j=1;j<=i;j++)
	s+=a[j];
	x=s;
}//用于求出每一位相加的和的函数
bool check(ll m){
	if(m<=1) 
	return false;
	if(m==2||m==3)
	return true;
	for(int i=2;i<=sqrt(m);i++)
	if(m%i==0)
	return false;
	return true;
}//质数判断 0为素数 1为质数 
int main(){
	cin>>l>>r;
	for(int i=l;i<=r;i++){
		int k=i*i;
		if(check(hz(k))!=0&&k<=r) 
		ans=ans*k%998244353;
	}
	if(ans!=1)
	cout<<ans;
	else cout<<0;
	return 0;
}

有没有大佬告诉我怎么改,求!

2023/9/15 16:41
加载中...