题目大意:
此题只有一组数据,
| o . o|旁边两个'|'不用管, 中间的点也忽略,都别管。就管中间的其他8个字符。
‘ ’代表0, ‘o’代表1。
如上图可看为01000001,这为二进制, 化为十进制为65, 对应字符‘A’。既输出的第一个字母。其他每行都代表一个字母,计算后输出就行。
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int h = 0, arr[8], i, k = 0;
char a, s, str[100];
gets(str);
while(scanf("%c", &s) && s != '_')
{
if (s == '|')
{
h ++;
if(h == 2)
{
k = 0;
h = 0;
a = arr[0] * 128 + arr[1] * 64 + arr[2] * 32 + arr[3] * 16 + arr[4] * 8 + arr[5] * 4 + arr[6] * 2 + arr[7] * 1;
printf("%c", a);
continue;
}
}
else if (s == 'o')
{
arr[k ++] = 1;
}
else if (s == ' ')
{
arr[k ++] = 0;
}
}
return 0;
}
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 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. |