#include
#include
#include
#include
const int MAXSIZE = 1000;
unsigned a[MAXSIZE];
void f1() {
unsigned date;
int i;
for(i = 0; i < MAXSIZE; ++i) {
date = rand()%(2015 - 1890 + 1) + 1890;
date = 10000 * date + rand()%1131 + 101;
a[i] = date;
}
}
int f2(unsigned date) {
unsigned year = date/10000;
unsigned month = date%10000/100;
unsigned day = date%10000%100;
if(year < 1890 || year > 2015) return 0;
if(month < 1 || month > 12) return 0;
if(day < 1 || day > 31) return 0;
if(month == 2) {
if(year%4 == 0 && year%100 != 0 || year%400 == 0) {
if(day > 29) return 0;
}
else if(day > 28) return 0;
}
switch(month) {
case 4:
case 6:
case 9:
case 11:if(day > 30) return 0;
}
return 1;
}
void f3(unsigned date) {
printf("%u年",date/10000);
printf("%02u月",date%10000/100);
printf("%02u日\n",date%10000%100);
}
int main() {
int i;
srand((unsigned)time(NULL));
f1();
for(i = 0; i if(f2(a[i])) f3(a[i]);
return 0;
}