(http://115.28.138.223/view.page?gpid=T25)
//1850的1月1号是星期二
#include<stdio.h>
#include<algorithm>
using namespace std;
int i,d,g,sum;
int m[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
int year(int y)
{
if((y%4==0&&y%100!=0)||(y%400==0))
return 1;
return 0;
}
void exist(int a,int b,int c,int y)
{
sum=0;
for(i=1850;i<y;i++)
sum+=year(i)?366:365;
//d=(sum+2)%7;
//printf("%d\n",d);
for(i=1;i<a;i++)
sum+=year(y)==1?m[1][i-1]:m[0][i-1];
d=(sum+2)%7;
if(d==0)
d+=7;
//printf("%d\n",d);
g=c>=d?(1+c-d):(c+8-d);
g+=(b-1)*7;
if((year(y)!=0&&g>m[1][a-1])||(year(y)==0&&g>m[0][a-1]))
printf("none\n");
else
printf("%d/%02d/%02d\n",y,a,g);
}
int main()
{
int y1,y2,a,b,c;
scanf("%d %d %d %d %d",&a,&b,&c,&y1,&y2);
for(int i=y1;i<=y2;i++)
exist(a,b,c,i);
return 0;
}