简单模拟

代码:

#include<iostream>
using namespace std;
//预处理月份,0代表平年,1代表润年
int mh[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 main(){
    int y,m,d;
    while(~scanf("%d%d%d",&y,&m,&d)){
        int f=0;
        if(y%4==0||(y%100&&y%400==0)) f=1;
        int ans=0;
        for(int i=0;i<m-1;++i) ans+=mh[f][i];
        printf("%d\n",ans+d);
    }
    return 0;
}