文章
19
粉丝
98
获赞
3
访问
10.3k
#include <stdio.h>
typedef struct data
{ int year;
int month;
int day;
}dat;
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{ dat riqi;
int m,d,sum=0,i=1;
while (scanf("%d%d%d", &riqi.year, &riqi.month, &riqi.day) != EOF){
m=riqi.month;
d=riqi.day;
if(riqi.year%400==0||(riqi.year % 4 == 0 && riqi.year % 100 != 0))
mon[2]=29;
for(;i<m;i++)
{sum=sum+mon[i];
}
sum=sum+d;
printf("%d",sum);
}
return 0;
}
登录后发布评论
用多组输入试试