40,ponvolu!
查看原帖
40,ponvolu!
1459919
Rocky423楼主2025/7/3 20:51

我为什么只得到了40个分点(两个AC点)

#include <bits/stdc++.h>
using namespace std;

bool judge(short x){
	short before=x,after=0;
	after+=before/10;
	after+=(before%10)*10;
	for(int j=2;j<x;j++){
		if(before%j==0||after%j==0){
			return false;
		}
	}
	return true;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	short a,b;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		if(judge(i)) cout<<i<<endl;
	}
	
	return 0;
} 
2025/7/3 20:51
加载中...