#include<iostream>
#include<stdio.h>
using namespace std;
#define ISLEAP(x) (0== x%4 && 0!= x%100)||(0==x%400)>0?1:0
int dayOfMonth[13][2]=
{
0,0,
31,31,
28,29,
31,31,
30,30,
31,31,
30,30,
31,31,
31,31,
30,30,
31,31,
30,30,
31,31
};//每月的天数
int main()
{
int y,n;
int month =1;
int day=1;
int flag =0;
while(cin >> y >>n)
{
month =1;
flag =0;
if(ISLEAP(y))
{
flag =1;
}
do{
if(n > dayOfMonth[month][flag])
{
n-=dayOfMonth[month][flag];
month++;
}
else
{
break;
}
}while(1);
day = n;
printf("%04d-%02d-%02d\n",y,month,day);
}
return 0;
}
/**************************************************************
Problem: 1186
User: itswyy
Language: C++
Result: Accepted
Time:120 ms
Memory:1520 kb
****************************************************************/
注意:输出时用%04d