注意判断闰年就好了 预处理能用空间换时间。
#include<iostream>
#include<cstdio>
using namespace std;</cstdio></iostream>

int model[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},//预处理
{0,31,29,31,30,31,30,31,31,30,31,30,31}};

bool ifyear(int year){
if((year%100!=0&&year%4==0)||year%400==0)//判断是否是闰年
return true;
else return false;
}

int main(){
int sum;
int year,month,day;
while(scanf("%d %d %d",&year,&month,&day)!=EOF){
sum=0;
if(ifyear(year)){
for(int i=1;i<month;i++)
sum=sum+model[1][i];
sum=sum+day;
}
else {
for(int i=1;i<month;i++)
sum=sum+model[0][i];
sum=sum+day;
}
printf("%d",sum);
printf("\n");
}

return 0;

}