来源:
#include <iostream>
#include<cstdio>
using namespace std;
#define isyear(x) (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
};
struct Date{
int Year;
int Month;
int Day;
void nextDay(){
++Day;
if(Day>dayofmonth[Month][isyear(Year)]){
Day=1;
++Month;
if(Month>12){
++Year;
Month=1;
}
}
}
};
int buf[3002][13][32];
int main()
{
Date tmp;
tmp.Year=0;
tmp.Month=1;
tmp.Day=1;
int cnt=0;
while(tmp.Year!=3001){
buf[tmp.Year][tmp.Month][tmp.Day]=cnt;
cnt++;
tmp.nextDay();
}
int y,n;
Date ls;
while(cin>>y>>n){
ls.Year=y;ls.Month=1;ls.Day=1;
for(int i=1;i<n;++i){
ls.nextDay();
}
printf("%04d-%02d-%02d\n",ls.Year,ls.Month,ls.Day);
}
return 0;
}