其实这题就是将第二个时间-第一个时间,小于0的补全就A了
代码如下:
var x,y,k:string;
l1,l2,x1,x2,x3,y1,y2,y3:longint;
begin
readln(x);
readln(y);
l1:=pos(':',x);
l2:=pos(':',y);
k:=copy(x,1,2); val(k,x1);
k:=copy(x,l1+1,2); val(k,y1);
k:=copy(y,1,2); val(k,x2);
k:=copy(y,l2+1,2); val(k,y2);
x3:=x1-x2;
y3:=y1-y2;
if y3<0 then
begin
y3:=y3+60;
x3:=x3-1;
end;
if x3<0 then
begin
x3:=x3+24;
end;
if x3<10 then
begin
write('0',x3,':');
if y3<10 then write('0',y3) else write(y3);
end
else
if y3<10 then
begin
write(x3,':0',y3);
end
else write(x3,':',y3);
end.