Rezultati

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

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 1,395 MiB 0,005 s OK
#2 10/10 1,391 MiB 0,005 s OK
#3 10/10 1,355 MiB 0,005 s OK
#4 10/10 1,391 MiB 0,000 s OK
#5 10/10 1,352 MiB 0,005 s OK
#6 10/10 1,352 MiB 0,005 s OK
#7 10/10 1,391 MiB 0,000 s OK
#8 10/10 1,391 MiB 0,000 s OK
#9 10/10 1,391 MiB 0,000 s OK
#10 10/10 1,391 MiB 0,005 s OK

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


int main()  {
    int st[2];
    st[0] = 0;
    st[1] = 0;
    
    char c;
    int i = 0;
    
    while((c=getchar()) != EOF) {
        //printf("%c", c);
        if(c == '0')    {
            st[i%2]++;
        } else if(c == '1') {
            st[(i+1)%2]++;
        } else  {
            
        }
        i++;
    }
    
    if(st[0] > st[1])
        printf("%d", st[1]);
    else
        printf("%d", st[0]);
    
    return 0;
}