Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,652 MiB 0,000 s OK
#2 10/10 8,512 MiB 0,000 s OK
#3 10/10 9,297 MiB 0,000 s OK
#4 10/10 9,363 MiB 0,000 s OK
#5 10/10 9,449 MiB 0,000 s OK
#6 10/10 9,367 MiB 0,000 s OK
#7 10/10 9,285 MiB 0,000 s OK
#8 10/10 9,316 MiB 0,000 s OK
#9 10/10 9,379 MiB 0,000 s OK
#10 10/10 9,457 MiB 0,000 s OK

Ocenjevani program (niz.py):
n = int(input())
stevilo = list(input())

counter = 0
if n <= 2:
    print(0)
else:    
    for i in range(n-2):
        if stevilo[i] == "0" and stevilo[i+1] == "1" and  stevilo[i+2] == "0":
            stevilo[i+2] = "1"
            counter += 1

    print(counter)