Rezultati

Up. imeNalogaJezikRezultatČas oddaje
fmffml-2018 Niz Python 3 100/100OK 19. apr '18 @ 16:55

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,590 MiB 0,000 s OK
#2 10/10 8,504 MiB 0,000 s OK
#3 10/10 8,656 MiB 0,000 s OK
#4 10/10 8,742 MiB 0,000 s OK
#5 10/10 8,676 MiB 0,000 s OK
#6 10/10 8,590 MiB 0,000 s OK
#7 10/10 8,742 MiB 0,000 s OK
#8 10/10 8,742 MiB 0,000 s OK
#9 10/10 8,590 MiB 0,000 s OK
#10 10/10 8,824 MiB 0,000 s OK

Ocenjevani program (prva.py):
def resi(n, niz):
    vsota = 0
    i = 0
    stevec = 0
    while i < n - 2:

        if niz[i] == "0" and niz[i+1:i+3] == "10":
            stevec += 1
            i = i + 2
        else:
            i += 1
            vsota += (stevec+1)//2
            stevec = 0
    vsota += (stevec+1)//2
    return vsota







a = input()
n = int(a)
niz = input()


print(resi(n, niz))