Rezultati

Up. imeNalogaJezikRezultatČas oddaje
vs33no-2018 Niz C 100/100OK 19. apr '18 @ 17:57

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 1,488 MiB 0,005 s OK
#2 10/10 1,457 MiB 0,005 s OK
#3 10/10 1,582 MiB 0,004 s OK
#4 10/10 1,578 MiB 0,000 s OK
#5 10/10 1,582 MiB 0,004 s OK
#6 10/10 1,555 MiB 0,000 s OK
#7 10/10 1,578 MiB 0,004 s OK
#8 10/10 1,555 MiB 0,000 s OK
#9 10/10 1,586 MiB 0,000 s OK
#10 10/10 1,555 MiB 0,004 s OK

Ocenjevani program (niz.c):
#include <stdio.h>
#include <string.h>

int main(){
	
	int n;
	scanf("%d", &n);
	int counter = 0;
	char string[n];
	scanf("%s",string);
	for(int i=0; i < n -2; i++){
		if(string[i] == '0' && string[i+1] == '1' && string[i+2] == '0'){
			counter++;
			i = i + 2;
		}
	}
	
	printf("%d\n", counter);
	return 0;
}