文章
21
粉丝
76
获赞
1
访问
13.7k
#include<stdio.h>
#include<stdlib.h>
int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int day(int n){
int year = n/10000;
int month = n%10000/100;
int da = n%10000%100;
days[2] = (year%4==0&&year%100!=0 || year%400==0?29:28);
while(month--){
da+=days[month];
}
while(year--){
da+=(year%4==0&&year%100!=0 || year%400==0?366:365);
}
return da;
}
int main(void){
int one,two;
scanf("%d",&one);
scanf("%d",&two);
int d = abs(day(one)-day(two))+1;
printf("%d\n",d);
return 0;
}
登录后发布评论
牛皮