Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,035 MiB 0,000 s OK
#2 10/10 3,176 MiB 0,004 s OK
#3 10/10 3,152 MiB 0,016 s OK
#4 10/10 3,160 MiB 0,028 s OK
#5 10/10 3,152 MiB 0,022 s OK
#6 10/10 3,160 MiB 0,028 s OK
#7 10/10 3,293 MiB 0,022 s OK
#8 10/10 3,301 MiB 0,022 s OK
#9 10/10 3,160 MiB 0,016 s OK
#10 10/10 3,156 MiB 0,028 s OK

Ocenjevani program (prva.cpp):
//============================================================================
#include <iostream>
#include <string>
using namespace std;

int main() {
	int SIZE, counter = 0;
	string s;
	cin >> SIZE >> s;

	for (int i = 0; i < SIZE - 2; i++) {
		if (s.substr(i, 3) == "010") {
			counter++;

			if (s.substr(i+2, 3) == "010") {
				i += 3;
			} else {
				i += 2;
			}
		}
	}

	cout << counter << endl;

	return 0;
}