|
|
back to boardwhy i got WA? help help help~!~!~!~!~! type info=record s:integer; f:integer; e:integer; end; var stu:array[1..101]of info; n,i,j:integer; temp:info; extra,sum:integer; begin readln(n); for i:=1 to n do readln(stu[i].s,stu[i].f,stu[i].e); for i:=1 to n-1 do for j:=1 to i do begin if stu[j].s>stu[j+1].s then begin temp:=stu[j]; stu[j]:=stu[j+1]; stu[j+1]:=temp; end; end; extra:=0; for i:=1 to n do begin sum:=stu[i].s+stu[i].f; if sum>stu[i].e then if (sum-stu[i].e)>extra then extra:=sum-stu[i].e; if sum>stu[i+1].s then stu[i+1].s:=sum; end; write(extra); readln; end. |
|
|