Rezultati

Up. imeNalogaJezikRezultatČas oddaje
DMT2018 Niz C 100/100OK 19. apr '18 @ 17:37

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

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

int main(){
	
	
	int n;
	scanf("%d", &n);
	int poteze = 0;
	int stevec = 0;
		
	char stevilo;
	int stevilo1;
	getchar();
	for (int i = 0; i < n; i++){
	stevilo = getchar();
	//printf("%c\n", stevilo);
	if (stevilo == '0' && stevec == 0){
		stevec = 1;
	}else if (stevilo == '0' && stevec == 2){
	poteze++;
	stevec = 0;
	}else if (stevilo == '1' && stevec == 1){
	stevec = 2;	
	}else if (stevilo == '1' && stevec == 2){
	stevec = 0;
	}
	

	}

	printf("%d\n", poteze);
	return 0;
	
}