1ac 5wa 3tle c++求助
查看原帖
1ac 5wa 3tle c++求助
585978
_Jarvis_楼主2022/10/29 09:30
#include<bits/stdc++.h>
using namespace std;
bool hw(int x)
{
	if(x>100&&x%2==0)
		return 0;
	if(x>100&&x%11==0)
		return 0;
    int y=x,num=0;
    while (y!=0)
    {
        num=num*10+y%10;
        y/=10;
    } 
    if (num==x) 
		return 1;
    else 
		return 0;
}
bool zs(int x){
	for(int i=3;i*1<x;i++){
		if(x%i==0){
			return 0;
		}
	}
	return 1;
}
int main(){
	int n,m,s=0;
	cin>>n>>m;
	for(int i=n;i<=m;i++){
		if(hw(i)){
			if(zs(i)){
				cout<<i;
			}
		}
	}
	return 0;
}


2022/10/29 09:30
加载中...