Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 11,105 MiB 0,000 s OK
#2 10/10 11,176 MiB 0,000 s OK
#3 10/10 11,383 MiB 0,000 s OK
#4 10/10 11,340 MiB 0,000 s OK
#5 10/10 11,340 MiB 0,000 s OK
#6 10/10 11,336 MiB 0,000 s OK
#7 10/10 11,320 MiB 0,000 s OK
#8 10/10 11,320 MiB 0,000 s OK
#9 10/10 11,336 MiB 0,000 s OK
#10 10/10 11,301 MiB 0,000 s OK

Ocenjevani program (niz.py):
import sys
import random

N = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
c = 0

prejsnji = False

for i in range(N):
    if s[i:i+3] == '010':
        c += 1

        if prejsnji is not False and i - prejsnji == 2:
            c -= 1
            prejsnji = False
        else:
            prejsnji = i

print(c)