Here's my code:
Code: Select all
removed
Moderator: Board moderators
Code: Select all
removed
Code: Select all
4
oo--oooo-ooo
oooo-oooo-oo
-oooo-oo-oo-
oooooooo-oo-
Code: Select all
2
1
1
2
Code: Select all
int state[15];
int getmin(int index) {
......
}
int main() {
int test;
char line[15];
char ch;
scanf("%d", &test);
while (test--) {
int index = 0;
for (int i = 0; i < 12;) {
ch = getchar();
if (ch == 'o' || ch == '-') {
index = index * 2 + (ch == 'o' ? 1 : 0);
state[i] = (ch == 'o' ? 1 : 0);
i++;
} else if (ch == '\n' || ch == (char)EOF)
break;
else
continue;
}
// i get TLE without even calling the getmin()..
//int res = getmin(index);
//printf("%d\n", res);
printf("%d\n", index%12);
}
return 0;
}