Created
November 11, 2012 13:30
-
-
Save orisano/4054886 to your computer and use it in GitHub Desktop.
PCK本戦1問目:後になって書いてみた編
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
enum {A, X, Y, Z, W, B, ERROR}; | |
int map[6][2] = { | |
{X, Y}, | |
{ERROR, Z}, | |
{X, ERROR}, | |
{W, B}, | |
{B, Y}, | |
{Y, X} | |
}; | |
int main(void) | |
{ | |
int sw; | |
int now_pos; | |
for (now_pos = A; (sw = getchar()) != '#';){ | |
if (sw == '\n'){ | |
puts(now_pos == B ? "Yes" : "No"); | |
now_pos = A; | |
continue; | |
} | |
if (now_pos == ERROR) continue; | |
now_pos = map[now_pos][sw == '1']; | |
} | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment