|
|
вернуться в форумhelp, TLE#6, here is my code! Послано Bobur 11 апр 2008 23:37 program Project1; {$APPTYPE CONSOLE} uses SysUtils; var i, j, m, n, maxa, x0, xn, x, p : integer; s : int64; l : real; a : array [1..10000] of integer; begin readLn(n, m); maxa := 0; s := 0; for i := 1 to n do begin readLn(l); a[i] := round(100*l); s := s + a[i]; if maxa < a[i] then maxa := a[i]; end; if s div m < 1 then writeLn('0.00') else begin if m = 1 then writeLn(maxa/100:10:2) else begin xn := s div m; x0 := 0; repeat p := 0; x := (xn+x0) div 3; for i := 1 to n do inc(p, a[i] div x); if p >= m then x0 := x else xn := x; until p = m; for i := xn downto x0 do begin p := 0; for j := 1 to n do inc(p, a[j] div i); if p = m then begin writeLn(i/100:0:2); halt; end; end; end; end; end. |
|
|