|
|
вернуться в форумSO help me!! i tried to understand but still WA! :P Var a :array[0..100,1..3] of integer; i,j,n :byte; now,ans :integer; begin readln(n); for i:=1 to n do readln(a[i,1],a[i,2],a[i,3]); for i:=1 to n-1 do for j:=i+1 to n do if a[i,1]>a[j,1] then begin a[0]:=a[i]; a[i]:=a[j]; a[j]:=a[0]; end; ans:=0; now:=a[1,1]; for i:=1 to n do begin now:=now+a[i,2]; if now-a[i,3]>ans then ans:=now-a[i,3]; end; writeln(ans); end. What is goin` wrong??? DOnt WAste YOur TIme! I GOt AC ....! > Var > a :array[0..100,1..3] of integer; > i,j,n :byte; > now,ans :integer; > begin > readln(n); > for i:=1 to n do readln(a[i,1],a[i,2],a[i,3]); > for i:=1 to n-1 do > for j:=i+1 to n do > if a[i,1]>a[j,1] then begin > a[0]:=a[i]; a[i]:=a[j]; a[j]:=a[0]; end; > ans:=0; now:=a[1,1]; > for i:=1 to n do begin > now:=now+a[i,2]; > if now-a[i,3]>ans then ans:=now-a[i,3]; > end; > writeln(ans); > end. > > > What is goin` wrong??? ~~~~~~~~~ i forgot : if now<a[i,1] then now:=a[i,1] !!!! thx! i've got AC! Послано Bobur 26 мар 2008 23:04 |
|
|