Decode the tape
Time Limit: 1 second
"Machines take me by surprise with great frequency." |
Your boss has just unearthed a roll of old computer tapes. The tapes ha
ve 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. |
Problemsetter: Igor Naverniouk
Special thanks: BSD games ppt.
#include <stdio.h>
int c[] = {0, 0, 64, 32, 16, 8, 0, 4, 2, 1, 0}; //用数组保存权值
int main()
{
char str[12];
int i, sum;
gets(str); //读掉最上面一行的横线
while(gets(str))
{
sum = 0;
if(str[0] == '_')
{
break;
}
for(i = 0; i < 12; i++)
{
if(str[i] == 'o')
{
sum += c[i];
}
}
printf("%c", sum);
}
return 0;
}
o代表1 空格代表0