回复 88楼 浮云之冰雪
#include "stdio.h"
#define N 8113
main()
{
int
y=0,x=1;
int year,mon,day;
for(year=1777;year<1778;year++)
for(mon=5;mon<=12;mon++)
{if(mon==5||mon==7||mon==8||mon==10||mon==12)
{for(day=1;day<=31;day++)
x++;}
else if(mon==6||mon==9||mon==11)
{for(day=1;day<=30;day++)
x++;}
}
for(year=1778;year<2012;year++)
{for(mon=1;mon<=12;mon++)
{if(year%4==0&&year%100!=0||year%400==0)
{if(mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12)
for(day=1;day<=31;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
else if(mon==4||mon==6||mon==9||mon==11)
for(day=1;day<=30;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
else
for(day=1;day<=29;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
}
else
{if(mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12)
for(day=1;day<=31;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
else if(mon==4||mon==6||mon==9||mon==11)
for(day=1;day<=30;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
else
for(day=1;day<=28;day++)
{x++;
if(x==N)
{
if(mon<10&&day<10)
printf("%d-0%d-0%d",year,mon,day);
else if(mon<10&&day>=10)
printf("%d-0%d-%d",year,mon,day);
else if(mon>=10&&day<10)
printf("%d-%d-0%d",year,mon,day);
else
printf("%d-%d-%d",year,mon,day);
}}
}
}
}
}