运行不了(对不对是另一回事)
查看原帖
运行不了(对不对是另一回事)
1373219
acommonman楼主2024/7/9 13:48
#define _CRT_SECURE_NO_WARNINGS 1 
//#include<bits/stdc++.h>
#include<iostream>
//#include<string>
using namespace std;
int huiwen(int x)
{
	int c[100000000],s=1;
	memset(c, 0, sizeof(c));
	while (x > 0)
	{
		c[s] = x % 10;
		x /= 10;
		s++;
	}
	for (int i = 1; i <= s / 2; i++)
		if (c[i] != c[s - i])return 0;
	return 1;
}
int sushu(int x)
{
	for (int i = 2; i <= x; i++)if (x % i == 0)return 0;
	return 1;
}
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	for (int i = a; i <= b; i++)
		if (huiwen(i) == 1)
			if (sushu(i) == 1)
				printf("%d\n", i);
	return 0;
}
2024/7/9 13:48
加载中...