Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,652 MiB 0,000 s OK
#2 10/10 8,566 MiB 0,000 s OK
#3 10/10 8,703 MiB 0,144 s OK
#4 10/10 8,871 MiB 0,108 s OK
#5 10/10 8,660 MiB 0,000 s OK
#6 10/10 8,852 MiB 0,071 s OK
#7 10/10 8,703 MiB 0,183 s OK
#8 10/10 8,664 MiB 0,068 s OK
#9 10/10 8,703 MiB 0,093 s OK
#10 10/10 8,863 MiB 0,260 s OK

Ocenjevani program (string.py):
import sys

f=sys.stdin
n=int(f.readline())
s=f.readline()
t=0
co=0
for i in range(n-1):
	
	if s[i]=='0' :
		if s[i+1:i+3]=='10':
			s=s[:i+2]+'1'+s[i+3:]
			co+=1
print(co)