40分求助!!
查看原帖
40分求助!!
1041251
luo_han楼主2023/7/27 09:14
#include <bits/stdc++.h>
using namespace std;
long long z(long long x) {
    if(x == 1)
        return 0;
    if(x == 2)
        return 1;
    for (long long i = 2; i < x; i++)
        if(x % i == 0) 
            return 0;
    return 1;
}
int main() {
    long long s, m, n, a, b;
    scanf("%lld%lld", &m, &n);
    for (s = m; s <= n; s++) {
        a = s / 100;
        b = s / 10;
        if(zs(s) == 1 && z(a)==1&&z(b)==1)
            printf("%lld\n", s);
    } 
    return 0; 
}
2023/7/27 09:14
加载中...