Rezultati

Up. imeNalogaJezikRezultatČas oddaje
programatorji-2017 Hodnik Python 3 100/100OK 20. apr '17 @ 16:47

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,391 MiB 0,000 s OK
#2 10/10 8,352 MiB 0,000 s OK
#3 10/10 8,379 MiB 0,000 s OK
#4 10/10 8,348 MiB 0,000 s OK
#5 10/10 8,352 MiB 0,000 s OK
#6 10/10 8,371 MiB 0,000 s OK
#7 10/10 8,375 MiB 0,000 s OK
#8 10/10 8,391 MiB 0,000 s OK
#9 10/10 8,348 MiB 0,000 s OK
#10 10/10 8,355 MiB 0,000 s OK

Ocenjevani program (hocnik.py):
luci = input()
nicena = ""
enanic = ""

for i in range (len(luci)):
    if i % 2 == 0:
        nicena+="0"
        enanic+="1"
    else:
        nicena+="1"
        enanic+="0"

flips1 = 0
flips2 = 0

for i in range (len(luci)):
    if nicena[i] != luci[i]:
        flips1 += 1
    if enanic[i] != luci[i]:
        flips2 += 1

#print (luci)
#print (nicena)
#print (enanic)
if flips1 > flips2:
    print (flips2)
else:
    print(flips1)