#include<stdio.h>
int main(){
int daysOfMonth[13]={31,31,28,31,30,31,30,31,31,30,31,30,31};
int y0,y1,m0,m1,d0,d1,days,daysInYear0,daysInYear1;
while (scanf("%d%d%d%d%d%d",&y0,&m1,&d0,&y1,&m1,&d1)!=EOF){
if(y0*10000+m0*100+d0>y1*10000+m1*100+d1){
int k;
k=y0,y0=y1,y1=k;
k=m0,m0=m1,m1=k;
k=d0,d0=d1,d1=k;
}
days = 0,daysInYear0=0,daysInYear1=0;
for(;y1==y0;y0++)
days+=y0%4?365:y0%100?366:y0%400?365:366;
daysOfMonth[2]=y0%4?28:y0%100?29:y0%400?28:29;
for (int i=1 ;i<=m0-1,i++)
daysInYear0+=daysOfMonth[i];
for (int i=1 ;i<=m0-1;i++)
daysInYear1+=daysOfMonth[i];
daysInYear0+=d0;
daysInYear1+=d1;
days+=daysInYear1-daysInYear0;
printf("%d\n",days);
//for(;y1!=y0;y0++)
// daysInYear0+=day
}
}
#include
int main(){
int daysOfMonth[13]={31,31,28,31,30,31,30,31,31,30,31,30,31};
int y0,y1,m0,m1,d0,d1,days,daysInYear0,daysInYear1;
while (scanf("%d%d%d%d%d%d",&y0,&m1,&d0,&y1,&m1,&d1)!=EOF){
if(y0*10000+m0*100+d0>y1*10000+m1*100+d1){
int k;
k=y0,y0=y1,y1=k;
k=m0,m0=m1,m1=k;
k=d0,d0=d1,d1=k;
}
days = 0,daysInYear0=0,daysInYear1=0;
for(;y1==y0;y0++)
days+=y0%4?365:y0%100?366:y0%400?365:366;
daysOfMonth[2]=y0%4?28:y0%100?29:y0%400?28:29;
for (int i=1 ;i<=m0-1,i++)
daysInYear0+=daysOfMonth[i];
for (int i=1 ;i<=m0-1;i++)
daysInYear1+=daysOfMonth[i];
daysInYear0+=d0;
daysInYear1+=d1;
days+=daysInYear1-daysInYear0;
printf("%d\n",days);
//for(;y1!=y0;y0++)
// daysInYear0+=day
}
}
scanf那一行寫錯了
m0沒存到,寫了兩個m1