//闰年的2月为29天,非闰年为28天
#include<iostream>
#include<stdio.h>
using namespace std;
int max_days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
//判断年月日是否合法
bool check(int year,int month,int day)
{
if(month==0||month>12)return false;
if(day==0)return false;
if(month!=2)
{
if(day>max_days[month])return false;
}
else
{
int leap=(year%4==0&&year%100!=0)||(year%400==0);
if(day>28+leap)return false;
}
}
int main()
{
int a,b,c;
scanf("%d/%d/%d",&a,&b,&c);
int data;
for(data=19600101;data<=20591231;data++)
{
int nian,yue,ri;
nian=data/10000;
yue=data%10000/100;
ri=data%100;
if(check(nian,yue,ri))
{
if((nian%100==a&&yue==b&&ri==c)||(ri==a&&nian%100==b&&yue==c)||(yue==a&&ri==b&&nian%100==c))
cout<<nian<<'-'<<yue<<'-'<<ri<<endl;
}
}
return 0;
}
09-25
252
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)