Decode the tape
Time Limit: 1 second
"Machines take me by surprise with great frequency." |
Alan Turing
Your boss has just unearthed a roll of old computer tapes. The tapes have holes in them and might contain some sort of useful information. It falls to you to figure out what is written on them.
Input
The input will contain one tape.
Output
Output the message that is written on the tape.
Sample Input | Sample Output |
___________ | o . o| | o . | | ooo . o| | ooo .o o| | oo o. o| | oo . oo| | oo o. oo| | o . | | oo . o | | ooo . o | | oo o.ooo| | ooo .ooo| | oo o.oo | | o . | | oo .oo | | oo o.ooo| | oooo. | | o . | | oo o. o | | ooo .o o| | oo o.o o| | ooo . | | ooo . oo| | o . | | oo o.ooo| | ooo .oo | | oo .o o| | ooo . o | | o . | | ooo .o | | oo o. | | oo .o o| | o . | | oo o.o | | oo . o| | oooo. o | | oooo. o| | o . | | oo .o | | oo o.ooo| | oo .ooo| | o o.oo | | o. o | ___________ | A quick brown fox jumps over the lazy dog. |
题意:解码。
思路:7位的二进制。
AC代码如下:
#include<cstdio>
#include<cstring>
using namespace std;
char str[100];
int main()
{ gets(str);
while(true)
{ gets(str);
if(str[2]=='_')
break;
else
{ int k=0;
if(str[9]=='o')
k+=1;
if(str[8]=='o')
k+=2;
if(str[7]=='o')
k+=4;
if(str[5]=='o')
k+=8;
if(str[4]=='o')
k+=16;
if(str[3]=='o')
k+=32;
if(str[2]=='o')
k+=64;
printf("%c",k);
}
}
}