ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1070. Local Time

I have found some wrongs but still WA, Can you help me
Posted by Ural_Happy New Year! 27 Mar 2003 15:45
I have mended some wrong but still WA?
======================================================================
var s1,s2,s3,s4,a1,a2,b1,b2,t:real;
    total:longint;
function sov(aa:real):real;
var x,y:real;
begin
     y:=frac(aa)*100;
     x:=trunc(aa);
     sov:=x+y/60;
end;
begin
     read(s1,s2,s3,s4);
     a1:=sov(s1);
     b1:=sov(s2);
     a2:=sov(s3);
     b2:=sov(s4);
     if a1>b1 then b1:=b1+24
        else if b2-a2>11 then begin t:=b2; b2:=a2+24; a2:=t; end;
     if a2>b2 then b2:=b2+24
        else if b1-a1>5 then begin t:=b1; b1:=a1+24; a1:=t; end;
     total:=trunc(abs((b1-a1)-(b2-a2)/2));
     writeln(t);
end.
What's the local time if there is not in one day?