文章
145
粉丝
217
获赞
21
访问
84.6k
#include <stdio.h>
int CalDay(int y,int m,int d)
{
int i,a[12] = {31,28,31,30,31,30,31,31,30,31,30,31},sum = 0;
if(y % 400 == 0 || (y % 100 != 0 && y % 4 == 0))
a[1] = 29;
for(i = 0; i < m-1; i++)
sum += a[i];
return sum+d;
}
int main()
{
int n,i;
while(scanf("%d",&n) != EOF)
{
int y,m,d;
for(i = 0; i < n; i++)
{
scanf("%d %d %d",&y,&m,&d);
printf("%d\n",CalDay(y,m,d));
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发