1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <stdio.h>
int setTime(char time[],int i,int j)
{
return (10*((int)time[i]-48) + ((int)time[j]-48));
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int h1,m1,h2,m2,dis,gap,plan2;
char time[6];
scanf("%s",time);
h1 = setTime(time,0,1);
m1 = setTime(time,3,4);
scanf("%s",time);
h2 = setTime(time,0,1);
m2 = setTime(time,3,4);
scanf("%d",&dis);
gap = (h1-h2)*60 + (m1-m2);
printf("%.1f ",(float)(gap+dis));
plan2 = 2*dis<=gap ? gap : (gap/2 + dis);
printf("%.1f\n",(float)plan2);
}
return 0;
}
|