B
Accept:130 | |
Time | |
Description
给出两个时间(24小时制),求第一个时间至少要经过多久才能到达第二个时间。给出的时间一定满足的形式,其中x和y分别代表小时和分钟。$0x24,0y
InputFormat
第一行为数据组数T(1≤T≤50000)。
每组数据包括两行,分别代表两个时间。
OutputFormat
每组数据输出一行,表示最少经过的分钟数。
SampleInput
2
7:00
7:00
7:00
8:00
SampleOutput
0
60
# include <stdio.h>
int main()
{
int t;
int i;
int x1,y1,x2,y2;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d%:%d",&x1,&y1);
scanf("%d%:%d",&x2,&y2);
if(x1==x2)
printf("%d\n",y2-y1);
else
if(y1>y2)
printf("%d\n",60*(x2-x1)+(60-y1)+y2);
else
printf("%d\n",60*(x2-x1)+(y2-y1));
}
return 0;
}