/* It is just a binary counter, counting down from an initial pattern */ /* The initial pattern is the answer, but what if they don't realize? */ #include #include #include #include typedef long long ll; void printstr(char *critters,int N) { do{ printf("%c",critters[N--]); }while(N>=0); printf("\n"); } int main() { ll bits = 0; ll mask; int N,i; // ocelots are 1, zebras are 0 int line = 0; int ch; ll count=0; if(scanf("%d",&N)!=1) { perror("error reading N:"); exit(1); } ++line; for(i=0;i 0) { mask = 1; while(! (mask & bits)) mask <<= 1; bits ^= mask; mask--; bits |= mask; count++; } printf("%lld\n",count); return 0; }