|
|
вернуться в форумProblems !!! Help me!! WA #2 Послано De5 22 фев 2009 18:26 program verv; var a : array [1 .. 20000] of Integer; d, d2, min, k, n, i, j : Longint; begin k := 0; Readln (n, d); d2 := 0; for i := 1 to n do begin Read (a[i]); if ((d - a[i]) > 0) then begin min := d - a[i]; for j := i + 1 to n do Read (a[j]); Break; end; end; for i := 1 to n do begin if ((d + d2) - a[i]) > 0 then begin if ((d + d2) - a[i]) < min then min := (d + d2) - a[i]; d2 := d2 + (d - a[i]); k := k + a[i]; end else k := k + d; end; Writeln (k, ' ', min); end. SHE DONT can AC !!!! Please help me Edited by author 22.02.2009 18:27 |
|
|