萌新蒟蒻求助
  • 板块学术版
  • 楼主xlz2009
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/6/27 22:21
  • 上次更新2023/11/3 12:16:56
查看原帖
萌新蒟蒻求助
558550
xlz2009楼主2023/6/27 22:21

本人写的c++代码如下:

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

typedef long long LL;

#define NR 1000000005
bool a[NR];
bool b[NR];

bool isPalindromeNumber(LL num)
{
    int fresh = 0;
    if (num < 0 || (num > 0 && num % 10 == 0))
        return false;
    while (fresh < num)
    {
        fresh *= 10;
        fresh += num % 10;
        num /= 10;
    }
    if (num == fresh || num == fresh / 10)
        return true;
    return false;
}

int main()
{
    LL t;
    cin >> t;
    LL cnt = 0;
    for (LL i = 1; i <= t; i++)
    {
        LL tmp;
        cin >> tmp;
        if (isPalindromeNumber(tmp))
        {
            cnt++;
            if (i > 1e9)
                a[i] = 1;
            else
            {
                LL tmpp = i - 1000000000;
                b[tmpp] = 1;

            }
            
        }
    }
    cout << cnt;
    for (LL i = 1; i <= t; i++)
    {
        if (i > 1e9)
        {
            if (a[i])
                cout << "Yes\n";
            else
                cout << "No\n";
        }
        else
        {
            if (b[i])
                cout << "Yes\n";
            else
                cout << "No\n";
        }
    }
    return 0;
}

原题链接:传送门

为何总是如下图:

调试了半天啊啊,用的是win32的g++编译,系统版本无问题,用的是windows,一直报错,找不出问题。

有大佬可以解答一下的吗?

2023/6/27 22:21
加载中...