Rezultati

Up. imeNalogaJezikRezultatČas oddaje
targaryens-2017 Hodnik Python 100/100OK 20. apr '17 @ 17:41

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 6,605 MiB 0,000 s OK
#2 10/10 6,605 MiB 0,000 s OK
#3 10/10 6,609 MiB 0,000 s OK
#4 10/10 6,641 MiB 0,000 s OK
#5 10/10 6,641 MiB 0,000 s OK
#6 10/10 6,648 MiB 0,000 s OK
#7 10/10 6,621 MiB 0,000 s OK
#8 10/10 6,621 MiB 0,000 s OK
#9 10/10 6,656 MiB 0,000 s OK
#10 10/10 6,621 MiB 0,000 s OK

Ocenjevani program (quare.py):
import sys
from collections import Counter
output ={"odd":  [], "even": []}


def hallway(input):

    i = 0
    j = 1
    output["odd"] = [input[x] for x in range(0, len(input), 2)]
    output["even"] = [input[x] for x in range(1, len(input), 2)]
        #calculate number of 1s
    ones_in_odd = output["odd"].count("1")
    ones_in_even = output["even"].count("1")
    difference = 0
    if ones_in_even > ones_in_odd:
        difference  = len(output["even"]) - ones_in_even

        difference += ones_in_odd
    else:
        difference  = len(output["odd"]) - ones_in_odd

        difference += ones_in_even
    print(difference)
    return difference

hallway(raw_input())