C++ 代码
#include<bits/stdc++.h>
using namespace std;
int months[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool check(int year,int month,int day)
{
if(!month||month>12||!day)return false;
else if(month!=2&&day>months[month])return false;
else if(month==2)
{
int heap=year%400==0||year%100!=0&&year%4==0;
if(day>28+heap)return false;
}
return true;
}
int main()
{
int a,b,c;
scanf("%d/%d/%d",&a,&b,&c);
int year,month,day;
for(int i=19600101;i<=20591231;i++)
{
year=i/10000,month=i%10000/100,day=i%100;
if(check(year,month,day))
if(year%100==a&&month==b&&day==c||month==a&&day==b&&year%100==c||day==a&&month==b&&year%100==c)
printf("%02d-%02d-%02d\n",year,month,day);
}
return 0;
}