Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 3,191 MiB 0,004 s OK
#2 10/10 3,191 MiB 0,004 s OK
#3 10/10 3,188 MiB 0,004 s OK
#4 10/10 3,102 MiB 0,004 s OK
#5 10/10 3,188 MiB 0,004 s OK
#6 10/10 3,191 MiB 0,004 s OK
#7 10/10 3,102 MiB 0,004 s OK
#8 10/10 3,195 MiB 0,004 s OK
#9 10/10 3,105 MiB 0,004 s OK
#10 10/10 3,195 MiB 0,004 s OK

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

using namespace std;

#define fi first
#define se second
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 3111

string str;

int main(){
    int n;
    int ans = 111111;
    cin >> str;
    n = str.length();
    
    int cur = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 != str[i] - '0')
            cur++;
    }
    ans = min(ans, cur);
    cur = 0;
     for(int i = 0; i < n; i++){
        if(i % 2 == str[i] - '0')
            cur++;
    }
    ans = min(ans, cur);
    printf("%d", ans);
    return 0;
    
}