Ranking (as of 2013-06-09): 655 out of 3135
Language: C++
/* UVa 10878 - Decode the tape To build using Visual Studio 2008: cl -EHsc -O2 decode_the_tape.cpp */ #include <cstdio> int main() { const int nr_chrs = 16; char line[nr_chrs]; while (gets(line)) { if (line[0] != '|') { continue; } char c = 0; for (int i = 1; i < 10; i++) { if (i > 1 && line[i] != '.') c <<= 1; if (line[i] == 'o') c |= 1; } putchar(c); } return 0; }
No comments:
Post a Comment