Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Emilio Hodnik Python 2 100/100OK 20. apr '17 @ 17:52

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 6,227 MiB 0,000 s OK
#2 10/10 6,258 MiB 0,000 s OK
#3 10/10 6,227 MiB 0,000 s OK
#4 10/10 6,227 MiB 0,000 s OK
#5 10/10 6,258 MiB 0,000 s OK
#6 10/10 6,230 MiB 0,000 s OK
#7 10/10 6,230 MiB 0,000 s OK
#8 10/10 6,262 MiB 0,000 s OK
#9 10/10 6,230 MiB 0,000 s OK
#10 10/10 6,230 MiB 0,000 s OK

Ocenjevani program (hallway.py):
import fileinput

input = fileinput.input().readline()

#0
one = False
change_count = 0
for c in input:
    if one and c == '0':
        change_count += 1
    if not one and c == '1':
        change_count += 1
    
    one = not one



#1
one = True
change_count2 = 0
for c in input:
    if one and c == '0':
        change_count2 += 1
    if not one and c == '1':
        change_count2 += 1
    
    one = not one

print min(change_count, change_count2)