题目描述
读入两个用“时:分:秒”表示的时间点,计算以秒为单位的时间间隔。
输入
输入有两行,每行是一个用“时:分:秒”表示的时间点。测试数据保证第二个时间点晚于第一个时间点。
输出
输出一个整数,表示时间间隔的秒数。
样例输入
08:00:00 09:00:00
样例输出
3600
代码
#include<stdio.h>
int main()
{
int h1,h2,m1,m2,s1,s2;
scanf("%d:%d:%d\n",&h1,&m1,&s1);
scanf("%d:%d:%d\n",&h2,&m2,&s2);//注意按题目形式输入
int t1=0,t2=0,t3=0;//进行单位换算,将时间全部转换成秒
t1=h1*3600+m1*60+s1;
t2=h2*3600+m2*60+s2;
t3=t2-t1;
printf("%d\n",t3);
return 0;
}