|
|
вернуться в форумWhat I must do?? I'm sorry, but WTF??? My program works correct on sample and all other tests, but I got WA1 >< Code: program abcdefgh; var t1,t2,t3: array[1..100] of longint; i,k,j,n,time: longint; begin read(n); for i:=1 to n do readln(t1[i],t2[i],t3[i]); for i:=1 to n-1 do for j:=i+1 to n do begin if t1[i]>t1[j] then begin k:=t1[i]; t1[i]:=t1[j]; t1[j]:=k; k:=t2[i]; t2[i]:=t2[j]; t2[j]:=k; end; if t3[i]>t3[j] then begin k:=t3[i]; t3[i]:=t3[j]; t3[j]:=k; end; end; time:=0; for i:=1 to n do if t1[i]<time then inc(time,t2[i]) else time:=t1[i]+t2[i]; if time-t3[1]<0 then writeln(0) else writeln(time-t3[1]); end. Edited by author 25.06.2009 16:17 Re: What I must do?? Easy! You wrong here: > if time-t3[1]<0 then writeln(0) else writeln(time-t3[1]); This way to calculate time is wrong. Try this: 2 1 2 3 2 3 6 The answer is: 0 Your program output: 3 P.S. The first test is not necessary from statement, it may be more easier test, for exapmle. Edited by author 26.06.2009 02:28 Re: What I must do?? Thanks, now I got AC :) Edited by author 15.08.2009 14:53 |
|
|