|
|
вернуться в форумany help.... Послано Maniek 4 ноя 2001 23:06 the complexity of my solution is not fantastic but i get WRONG ANSWER...... any help would be very nice... here's my simple code for problem 1138: const Max = 10000; type tTable = array[1..Max] of longint; var t : tTable; procedure solve; var i, k, multi : longint; last, first : longint; begin readln(last, first); for i := first + 1 to last do t[i] := 0; t[first] := 1; for i := first to last - 1 do if t[i] > 0 then begin k := 1; multi := i + (i div 100); while multi <= last do begin if ((k * i) mod 100 = 0) and (t[multi] <= t[i]) then t[multi] := t[i] + 1; inc(k); multi := i + ((k * i) div 100); end; end; writeln(t[last]:0); end; begin solve; end. Output not t[last] but max(t[i])! What could be the highest possible number of previous jobs for mister Smart, if his latest salary DID NOT EXCEED n rubles and his first salary was exactly s rubles? |
|
|