2017.6.4测试 题二 睡眠2017.6.4测试 题二 睡眠

var
 s,t,ss:string;
 h,hh,m,mm,i,j:longint;
begin
 readln(s);//睡醒~
 ss:=copy(s,1,2);//将小时取出
 val(ss,h);//转成数字
 ss:=copy(s,4,5);//将分钟取出
 val(ss,m);
 readln(t);//睡醒~
 ss:=copy(t,1,2);
 val(ss,hh);
 ss:=copy(t,4,5);
 val(ss,mm);
 if (h<hh) or (h=hh) and (m<mm) then h:=h+24;//判断时候是否睡到明天
 if m<mm then begin//判断是否至少睡了一个小时
               h:=h-1;
               m:=m+60;
              end;
 if (h-hh<10) and (m-mm<10) then writeln(0,h-hh,':',0,m-mm)//不够10之前要输0在前面
                            else if h-hh<10 then writeln(0,h-hh,':',m-mm)//小时不够10~
                                            else if m-mm<10 then writeln(h-hh,':',0,m-mm)//分钟不够10~
                                                            else writeln(h-hh,':',m-mm);//都够了~
end.

相关文章:

  • 2021-09-20
  • 2022-12-23
  • 2021-06-15
  • 2021-06-22
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-04
  • 2021-11-11
  • 2021-06-11
  • 2021-06-13
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
相关资源
相似解决方案