#include<stdio.h>
#define ISYEAP(x) x%100!=0 && x%4==0 ||x%400==0 ?1 :0
int DayOfMonth[13][2]={
0,0,
31,31,//1
28,29,//2
31,31,//3
30,30,//4
31,31,//5
30,30,//6
31,31,//7
31,31,//8
30,30,//9
31,31,//10
30,30,//11
31,31 //12
};
void nextDay(int &year,int &month,int &day){
++day;
if(day>DayOfMonth[month][ISYEAP(year)]){
day=1;
++month;
if(month>12){
++year;
month=1;
}
}
}
int buf[3001][13][32];
int main(){
int year=0,month=1,day=1;
int cnt=0;//计算天数保存起来
while(year!=3001){
buf[year][month][day]=cnt;
nextDay(year,month,day);
cnt++;
}
int Y,M,D;
while(~scanf("%d%d%d",&Y,&M,&D)){
printf("%d\n",buf[Y][M][D]-buf[Y][1][1]+1);
}
return 0;
}
/*
1990 9 20
2000 5 1
样例输出:
263
122
*/
今天是今年第几天
最新推荐文章于 2022-11-04 20:21:14 发布