Rezultati

Up. imeNalogaJezikRezultatČas oddaje
mag-2017 Hodnik Python 3 100/100OK 20. apr '17 @ 18:29

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,383 MiB 0,000 s OK
#2 10/10 8,344 MiB 0,000 s OK
#3 10/10 8,391 MiB 0,000 s OK
#4 10/10 8,406 MiB 0,000 s OK
#5 10/10 8,340 MiB 0,000 s OK
#6 10/10 8,340 MiB 0,000 s OK
#7 10/10 8,363 MiB 0,000 s OK
#8 10/10 8,359 MiB 0,000 s OK
#9 10/10 8,371 MiB 0,000 s OK
#10 10/10 8,395 MiB 0,000 s OK

Ocenjevani program (hodnik.py):
import sys

vhod=(sys.stdin.readline().strip())

if len(vhod)%2==0:
    z1='10'* (len(vhod)//2)
    z2='01'* (len(vhod)//2)
else:
    z1 = ('10' * (len(vhod) // 2 )) + "1"
    z2 = ('01' * (len(vhod) // 2 )) + "0"
rez1=0
for x, y in zip(vhod,z1):
    if x!=y:
        rez1+=1
rez2=0
for x, y in zip(vhod,z2):
    if x!=y:
        rez2+=1

print(min(rez1,rez2))