自留代码
查看原帖
自留代码
1472033
lxyzbjt_楼主2025/6/30 14:40

因为rmj用不了。

#include<bits/stdc++.h>
using namespace std;
long long x;
long long su(long long x){
	for(long long i=2;i<x;i++){
		if(x%i==0)
			return 0;
	}
	return 1;
}
long long leisu(long long y){
	if(y%2==0) return 0;
	if(y%5==0) return 0;
	int ans=0;
	while(y>0){
		ans+=y%10;
		y/=10;
	}	
	return ans;
}
int main(){
	cin>>x;
	if(x==1||x==0){
		cout<<"Not Prime";
		return 0;
	}
	if(su(x)==1){
		cout<<"Prime";
		return 0;
	}
	else if(leisu(x)==0) cout<<"Not Prime";
	else if(leisu(x)%3!=0)
		cout<<"Prime";
	else cout<<"Not Prime";
	return 0;
}
2025/6/30 14:40
加载中...