根据年月日,判断已经多少天(2)
#include<stdio.h>
int main()
{
int y,m,ds,flag,n,d,k;
scanf("%d %d %d",&y,&m,&ds);
if(y%400==0)
flag=1;
else{
if(y%4==0&&y%100!=0)
flag=1;
else flag=0;
}
switch(m)
{
case 1:d=0;break;
case 2:d=31;break;
case 3:d=59;break;
case 4:d=90;break;
case 5:d=120;break;
case 6:d=151;break;
case 7:d=181;break;
case 8:d=212;break;
case 9:d=243;break;
case 10:d=273;break;
case 11:d=304;break;
case 12:d=334;break;
}
if(flag==1)d=d+1;
else d=d;
n=ds+d;
printf("%d",n);
}