# c语言 新手 请问我的代码哪里错了，运行正确，提交就是不对

0
[待解决问题]

Description

Input

Output

Sample Input

1900:01:01
2038:12:31

Sample Output

50768

#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;
}

wuqi568 | 菜鸟二级 | 园豆：202

您需要登录以后才能回答，未注册用户请先注册