运行不了(对不对是另一回事)

P1217 [USACO1.5] 回文质数 Prime Palindromes

acommonman @ 2024-07-09 13:48:37

#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;
}

by BK小鹿 @ 2024-07-09 13:53:52

@acommonman #include<cstring>


by BK小鹿 @ 2024-07-09 13:54:07

@acommonman memset要这个头文件


by FALLTOHER_LOVE @ 2024-07-09 14:00:52

直接用万能头就好了


by acommonman @ 2024-07-09 19:06:20

wow蟹蟹


|