Rezultati

Up. imeNalogaJezikRezultatČas oddaje
JayZCrew Pakiranje piva Python 3 100/100OK 20. apr '17 @ 17:23

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 8,680 MiB 0,000 s OK
#2 3/3 8,703 MiB 0,000 s OK
#3 3/3 8,676 MiB 0,000 s OK
#4 3/3 8,625 MiB 0,000 s OK
#5 3/3 8,660 MiB 0,000 s OK
#6 3/3 8,602 MiB 0,000 s OK
#7 3/3 8,660 MiB 0,000 s OK
#8 3/3 8,680 MiB 0,000 s OK
#9 3/3 8,676 MiB 0,000 s OK
#10 3/3 8,691 MiB 0,000 s OK
#11 3/3 8,590 MiB 0,000 s OK
#12 3/3 8,723 MiB 0,000 s OK
#13 3/3 8,625 MiB 0,000 s OK
#14 3/3 8,676 MiB 0,000 s OK
#15 3/3 8,598 MiB 0,000 s OK
#16 3/3 8,633 MiB 0,000 s OK
#17 3/3 8,699 MiB 0,000 s OK
#18 3/3 8,652 MiB 0,000 s OK
#19 3/3 8,695 MiB 0,000 s OK
#20 3/3 8,703 MiB 0,000 s OK
#21 3/3 8,691 MiB 0,000 s OK
#22 3/3 8,742 MiB 0,000 s OK
#23 3/3 8,742 MiB 0,000 s OK
#24 3/3 8,684 MiB 0,000 s OK
#25 4/4 8,723 MiB 0,000 s OK
#26 4/4 8,750 MiB 0,000 s OK
#27 4/4 8,715 MiB 0,000 s OK
#28 4/4 8,684 MiB 0,000 s OK
#29 4/4 8,715 MiB 0,000 s OK
#30 4/4 8,723 MiB 0,000 s OK
#31 4/4 8,715 MiB 0,000 s OK

Ocenjevani program (pivo.py):
import sys







N = int(sys.stdin.readline())
vhod = list()
for i in range(N):
    a = int(sys.stdin.readline().strip())
    vhod.append(a)

vhod.sort()

def preveri(n, k):
    LI = abs(n % k - k) % k
    return LI <= n//k + 1

def test(skatla, vhod):
    for pivo in vhod:
        if not preveri(pivo, skatla):
            return False
    return True

MIN = vhod[0]
koren = int(MIN**0.5) + 1

res = None

for k in range(1, koren + 1):
    zapis = MIN//k + 1
    if test(zapis, vhod):
        res = zapis
        break
    if test(zapis-1, vhod):
        res = zapis-1
        break

if res is None:
    for k in range(koren, 0, -1):
        if test(k, vhod):
            res = k
            break

print(res)