Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,027 MiB 0,004 s OK
#2 10/10 3,152 MiB 0,000 s OK
#3 10/10 3,262 MiB 0,000 s OK
#4 10/10 3,258 MiB 0,010 s OK
#5 10/10 3,262 MiB 0,004 s OK
#6 10/10 3,273 MiB 0,004 s OK
#7 10/10 3,262 MiB 0,000 s OK
#8 10/10 3,277 MiB 0,010 s OK
#9 10/10 3,262 MiB 0,010 s OK
#10 10/10 3,262 MiB 0,004 s OK

Ocenjevani program (main.cpp):
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

#define left(x) ((x) << 1)
#define right(x) ((x) << 1 | 1)
#define mid(x, y) ((x) + (y) >> 1)

using namespace std;

int R;
string text;

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> R >> text;

    if (R < 3) puts("0"), exit(0);

    R = 0;

    for (int i = 2; i < text.size(); i++) {
        if (text[i - 2] == '0' && text[i - 1] == '1' && text[i] == '0') {
            text[i] = '1';
            R++;
            i--;
        }
    }

    return !printf("%d\n", R);
}