jueves, 12 de julio de 2012

10878 - Decode the tape, uva

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
#define db(a) \
cout << #a << " = " << a << endl
#define db2(a, b) \
cout << #a << " = " << a << " " << #b << " = " << b << endl
#define inf (1<<30)
#define foreach(it, m) \
for (typeof(m.begin()) it = m.begin(); it != m.end(); it++)
using namespace std;
int main() {
 #ifdef dennisbot
  freopen("in.in", "r", stdin);
  freopen("ou.out", "w", stdout);
 #endif
 char s[20];
 while (gets(s) != NULL) {
  if (s[0] == '_') continue;
  int mask = 0;
  for (int i = 8; i >= 4; i--) {
   if (s[9 - i] == 'o') mask |= 1 << (i - 1);
  }
  for (int i = 2; i >= 0; i--) {
   if (s[9 - i] == 'o') mask |= 1 << i;
  }
  printf("%c", (char)mask);
 }
 return 0;
}
here is the statement

No hay comentarios:

Publicar un comentario