Problem A
Decode the tape
Time Limit: 1 second
Alan Turing
Problemsetter: Igor Naverniouk
Special thanks: BSD games ppt.
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 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. |
Problemsetter: Igor Naverniouk
Special thanks: BSD games ppt.
#include <stdio.h>
#include <string.h>
int main()
{
int a,p[8]={6,5,4,3,0,2,1,0};
char s[20];
while(gets(s)!=NULL)
{
if(s[0]=='|')
{
a=0;
for(int i=0;i<8;i++)
{
a|=(s[i+2]=='o')<<(p[i]);
}
printf("%c",a);
}
}
return 0;
}
解码计算机磁带
本文介绍了一种解码旧式计算机磁带上信息的方法,并提供了一个简单的C语言程序示例,该程序能够读取特定格式的磁带孔洞排列并将其转换为可读的文字消息。
1108

被折叠的 条评论
为什么被折叠?



