求助大佬!73分,8、9、10WA掉了……

P2010 [NOIP2016 普及组] 回文日期

LanzhouPaimonLucas @ 2022-08-15 22:43:40

真的,真的,整不会了……

本蒟蒻已经多次修改,已尽我所能……各位大佬还请帮本蒟蒻一把……

下面是代码

```cpp
#include <iostream>

using namespace std;

int main()
{
    int a, b, y, m, d, c, f[8], num = 0, weiquan = 10000000, e = 0, day[14] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29};
    cin >> a >> b;
    for (int i = a; i <= b; i++)
    {
        e = 0;
        weiquan = 10000000;
        y = i / 10000;
        m = i % 10000 / 100;
        d = i % 100;
        if (m > 12)
        {
            i = i + 8800 - d;
            continue;
        }
        if (d > day[m] && (y % 4 != 0 || y % 100 == 0 && y % 400 != 0))
        {
            i = i + 100 - d;
            continue;
        }
        if (m == 2 && d > day[13] && (y % 4 == 0 && y % 100 != 0 || y % 400 == 0))
        {
            i = i + 100 - d;
            continue;
        }
        c = i;
        for (int j = 0; j < 8; j++)
        {
            f[j] = c % 10;
            c /= 10;
            e = e + f[j] * weiquan;
            weiquan /= 10;
        }
        y = i / 10000;
        m = i % 10000 / 100;
        d = i % 100;
        if (m > 12)
        {
            continue;
        }
        if (d > day[m] && (y % 4 != 0 || y % 100 == 0 && y % 400 != 0))
        {
            continue;
        }
        if (m == 2 && d > day[13] && (y % 4 == 0 && y % 100 != 0 || y % 400 == 0))
        {
            continue;
        }
        //cout << e << ' ' << i << endl;
        if (e == i)
        {
            num++;
        }
    }
    cout << num;
    return 0;
}

|