Rezultati

Up. imeNalogaJezikRezultatČas oddaje
ayy-2018 Niz C++ 100/100OK 19. apr '18 @ 16:41

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,109 MiB 0,004 s OK
#2 10/10 3,023 MiB 0,000 s OK
#3 10/10 3,156 MiB 0,009 s OK
#4 10/10 3,293 MiB 0,009 s OK
#5 10/10 3,156 MiB 0,009 s OK
#6 10/10 3,297 MiB 0,016 s OK
#7 10/10 3,156 MiB 0,009 s OK
#8 10/10 3,160 MiB 0,009 s OK
#9 10/10 3,152 MiB 0,016 s OK
#10 10/10 3,297 MiB 0,009 s OK

Ocenjevani program (niz.cpp):
#include <iostream>

using namespace std;

int main() {
	int n, st = 0;
	cin >> n;
	
	string x;
	cin >> x;
	
	for (int i = 0; i < n - 2; i++) {
		if (x[i] == '0' && x[i + 1] == '1' && x[i + 2] == '0'){
			x[i + 2] = '1';
			st++;
		}
	}
	cout << st;
	return 0;
}