Rezultati

Up. imeNalogaJezikRezultatČas oddaje
qubit-2017 Hodnik C++ 100/100OK 20. apr '17 @ 16:35

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,137 MiB 0,004 s OK
#2 10/10 3,137 MiB 0,004 s OK
#3 10/10 3,125 MiB 0,004 s OK
#4 10/10 3,133 MiB 0,004 s OK
#5 10/10 3,129 MiB 0,004 s OK
#6 10/10 3,145 MiB 0,004 s OK
#7 10/10 3,133 MiB 0,004 s OK
#8 10/10 3,141 MiB 0,004 s OK
#9 10/10 3,141 MiB 0,004 s OK
#10 10/10 3,137 MiB 0,004 s OK

Ocenjevani program (n3.cpp):
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>

typedef long long ll;

using namespace std;

int main(void) {
    cin.tie(nullptr);
    cin.sync_with_stdio(false);

    string niz;
    cin >> niz;
    int len = niz.size();
    int res = 0;
    for (int i = 0; i < len; i++) {
        if (niz[i] == (i % 2 ? '0' : '1')) res++;
    }
    int mres = res;
    res = 0;
    for (int i = 0; i < len; i++) {
        if (niz[i] == ((i + 1) % 2 ? '0' : '1')) res++;
    }
    if (res < mres) mres = res;
    cout << mres << '\n';

    return 0;
}