Description
Input
Output
Sample Input
Sample Output
#include <stdio.h>
int year_(int year)
{
if(year%4==0&&year%100!=0||year%400==0)
return 366;
else return 365;
}
int year_sumday(int year,int month)
{
int ping[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int run[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int i,flag=0,sum=0;
if((year%4==0&&year%100!=0)||year%400==0)
flag=1;
else
flag=0;
for(i=0;i<=month-1;i++)
{
if(flag==1) sum +=run[i];
else sum +=ping[i];
}
return sum;
}
int day_cha(int year,int month,int day)
{
int i=0,day1=0;
while(i<=year)
{
day1 +=year_(i);
i++;
}
int day2=year_sumday(year,month);
return day1+day2+day;
}
int main()
{
int a,b,c;
int i,j,k;
scanf("%d:%d:%d",&a,&b,&c);
scanf("%d:%d:%d",&i,&j,&k);
int dday1=day_cha(a,b,c);
int dday2=day_cha(i,j,k);
int cha=0;
if(dday1>=dday2)
cha=dday1-dday2;
else
cha=dday2-dday1;
printf("%d",cha);
return 0;
}