标签:
http://ac.jobdu.com/problem.php?pid=1186
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define ISYEAR(x) x%4==0&&x%100!=00||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 Day;
int Month;
int Year;
void nextDay(){
Day++;
if(Day>dayOfMonth[Month][ISYEAR(Year)]){
Day=1;
Month++;
if(Month>12){
Month=1;
Year++;
}
}
}
};
*/
int buf[3001][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;
//nextDay();
tmp.nextDay();
cnt++;
}*/
int y,n,i;
while(scanf("%d%d",&y,&n)!=EOF){
for( i=0;n>dayOfMonth[i][ISYEAR(y)];i++){
n-=dayOfMonth[i][ISYEAR(y)];
}
printf("%04d-%02d-%02d\n",y,i,n);
}
return 0;
}
标签:
原文地址:http://blog.csdn.net/lanjiangzhou/article/details/42392285