Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 1,480 MiB 0,000 s OK
#2 10/10 1,477 MiB 0,005 s OK
#3 10/10 1,477 MiB 0,005 s OK
#4 10/10 1,477 MiB 0,000 s OK
#5 10/10 1,516 MiB 0,000 s OK
#6 10/10 1,477 MiB 0,000 s OK
#7 10/10 1,520 MiB 0,000 s OK
#8 10/10 1,520 MiB 0,005 s OK
#9 10/10 1,477 MiB 0,005 s OK
#10 10/10 1,480 MiB 0,005 s OK

Ocenjevani program (hodnik.c):
#include <stdio.h>

char B[1024];

int main() {
    int i = 0, a = 0, b = 0;
    scanf("%s", B);
    for (; B[i]; i++) {
        if (i & 1) (B[i] == '0' ? b++ : 0);
        else (B[i] == '1' ? a++ : 0);
    }
    printf("%d\n", (a + b < i - a - b) ? a + b : i - a - b);
    return 0;
}