Rezultati

Up. imeNalogaJezikRezultatČas oddaje
@memo2498F1-2017 Pakiranje piva Python 3 100/100OK 20. apr '17 @ 19:41

Test Točke Porabljen spomin Porabljen čas Status
#1 3/3 8,605 MiB 0,000 s OK
#2 3/3 8,637 MiB 0,000 s OK
#3 3/3 8,594 MiB 0,000 s OK
#4 3/3 8,598 MiB 0,000 s OK
#5 3/3 8,617 MiB 0,000 s OK
#6 3/3 8,648 MiB 0,000 s OK
#7 3/3 8,582 MiB 0,000 s OK
#8 3/3 8,590 MiB 0,000 s OK
#9 3/3 8,590 MiB 0,000 s OK
#10 3/3 8,629 MiB 0,000 s OK
#11 3/3 8,598 MiB 0,000 s OK
#12 3/3 8,621 MiB 0,000 s OK
#13 3/3 8,637 MiB 0,000 s OK
#14 3/3 8,656 MiB 0,000 s OK
#15 3/3 8,590 MiB 0,000 s OK
#16 3/3 8,625 MiB 0,000 s OK
#17 3/3 8,641 MiB 0,000 s OK
#18 3/3 8,645 MiB 0,000 s OK
#19 3/3 8,625 MiB 0,000 s OK
#20 3/3 8,645 MiB 0,000 s OK
#21 3/3 8,645 MiB 0,000 s OK
#22 3/3 8,625 MiB 0,000 s OK
#23 3/3 8,645 MiB 0,000 s OK
#24 3/3 8,645 MiB 0,000 s OK
#25 4/4 8,621 MiB 0,000 s OK
#26 4/4 8,645 MiB 0,000 s OK
#27 4/4 8,656 MiB 0,000 s OK
#28 4/4 8,660 MiB 0,000 s OK
#29 4/4 8,641 MiB 0,000 s OK
#30 4/4 8,660 MiB 0,000 s OK
#31 4/4 8,641 MiB 0,000 s OK

Ocenjevani program (pivo.py):
import sys

N = int(sys.stdin.readline().strip())

a = []
for i in range(N):
    ai = int(sys.stdin.readline().strip())
    a.append(ai)
    
def preveri(sez, k):
    for i in range(len(sez)):
        if sez[i]%(k-1) > sez[i] // (k-1):
            return False
    return True

# ne delaj s k = 1 (itak lahko damo v skatle velikosti 2 :))

#for k in range(min(a)+1, 1, -1):
#    if preveri(a, k):
#        print(k)
#        break
#    
#testni = list(range(10**9, 10**9 - 10, -1))
#print(testni)
mini = min(a)
for j in range( 1, mini + 2):
    k = mini//j +1
    if preveri(a, k):
        print(k)
        break
    k = k - 1
    if preveri(a, k):
        print(k)
        break