源代码:
#include<cstdio>
long long M[12]={31,28,31,30,31,30,31,31,30,31,30,31};
long long Ans1,Ans2,Y1,Y2,M1,M2,D1,D2,H1,H2,F1,F2,S1,S2;
char S[20];
int main() //全都变为seconds。
{
gets(S);
Y1=(S[0]-'0')*1000+(S[1]-'0')*100+(S[2]-'0')*10+S[3]-'0';
M1=(S[5]-'0')*10+S[6]-'0'-1;
D1=(S[8]-'0')*10+S[9]-'0'+(Y1-2000)/4;
H1=(S[11]-'0')*10+S[12]-'0';
F1=(S[14]-'0')*10+S[15]-'0';
S1=(S[17]-'0')*10+S[18]-'0';
if (!((Y1-2000)%4)&&M1<=2) //冗杂的细节。
D1--;
Ans1=(Y1-2000)*31536000+D1*86400+H1*3600+F1*60+S1;
for (int a=0;a<M1;a++)
Ans1+=M[a]*86400;
gets(S);
Y2=(S[0]-'0')*1000+(S[1]-'0')*100+(S[2]-'0')*10+S[3]-'0';
M2=(S[5]-'0')*10+S[6]-'0'-1;
D2=(S[8]-'0')*10+S[9]-'0'+(Y2-2000)/4;
H2=(S[11]-'0')*10+S[12]-'0';
F2=(S[14]-'0')*10+S[15]-'0';
S2=(S[17]-'0')*10+S[18]-'0';
if (!((Y2-2000)%4)&&M2<=2)
D2--;
Ans2=(Y2-2000)*31536000+D2*86400+H2*3600+F2*60+S2;
for (int a=0;a<M2;a++)
Ans2+=M[a]*86400;
printf("%I64d",(Ans2-Ans1)*1000);
return 0;
}