|
|
вернуться в форумHelp!! WA on 1st but test in example works!!!! program a_local_time_1070; {$APPTYPE CONSOLE} { 1070 Pascal } var to1,to2,tp1,tp2:real; min1,min2:integer; dd1,dd2,dd:integer; arrpl:array[1..6] of boolean; cou:integer; function dif(t1,t2:real):integer; var st1,st2,st3,st4:integer; m:boolean; diff:integer; begin m:=false; diff:=0; st1:=trunc(t1); st2:=trunc((t1-st1)*100); st3:=trunc(t2); st4:=trunc((t2-st3)*100); if (st1=st3) and (st2=st4) then m:=true; while m=false do begin inc(diff); inc(st2); if st2=60 then begin inc(st1); st2:=0; end; if st1=24 then begin st1:=0; end; if (st1=st3) and (st2=st4) then m:=true; end; dif:=diff; end; begin readln(to1,tp1); readln(to2,tp2); dd1:=dif(to1,tp1); dd2:=dif(to2,tp2); if dd1<dd2 then for cou:=1 to 6 do begin min1:=60*cou+dd1; min2:=dd2-60*cou; if (min1-min2>-11) and (min1-min2<11) then arrpl[cou]:=true; end else for cou:=1 to 6 do begin min1:=60*cou+dd2; min2:=dd1-60*cou; if (min1-min2>-11) and (min1-min2<11) then arrpl[cou]:=true; end; for cou:=1 to 6 do if arrpl[cou]=true then dd:=cou; writeln(dd); end. Unfortunately the first test is not always equal to the sample. The problem is rather difficult, but you can solve it (-) Re: Unfortunately the first test is not always equal to the sample. The problem is rather difficult, but you can solve it (-) ME TOO I DON'T KONW WHY. I CAN'T UNDERSTAND... |
|
|