#include <iostream>
using namespace std;
int morth[13] ={0,31,28,31,30,31,30,31,31,30,31,30,31};
int idx;
bool check(int n)
{
if (n % 100 > 31 || n % 100 == 0) return false;
if (n / 100 > 12|| n / 100 == 0) return false;
if (morth[n / 100] < n % 100) return false;
return true;
}
bool cmp(int a, int b, int c, int d)
{
if (a + 1 == b && b + 1 == c) return true;
if (b + 1 == c && c + 1 == d) return true;
return false;
}
int main()
{
for (int i = 1; i <= 1231; i ++ )
{
if (check(i))
{
int a, b, c, d;
a = i /1000, b = i / 100 % 10, c = i % 100 / 10, d = i % 10;
//cout << a << " " << b << " " << c <<" " << d << endl;
if(cmp(a,b,c,d))
{
cout << "2022" << a << b << c << d << endl;
idx ++ ;
}
}
}
cout << idx << endl;
return 0;
}
0 回复
0 转发
0 喜欢
1 阅读



