UVa 10878 Decode the tape

本文揭示了如何解析从已故计算机科学家艾伦·图灵的办公室中发现的孔洞磁带上的信息,通过理解其编码方式,最终解密出隐藏在其中的谜语。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Description

 

"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

___________
| 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 |
___________

Sample Output

A quick brown fox jumps over the lazy dog.


对应的是二进制啊。。。那个  . 没有意义。总共7位,o 代表1,空格代表0(zero)

|  o  .   |
代表空格。。。翻译过来就是0100000,是ascii的32

#include <stdio.h>
#include <string.h>

int a[11] = {0, 0, 64, 32, 16, 8, 0, 4, 2, 1, 0};

int main() {
	char str[20];
	fgets(str,20, stdin);
	while (fgets(str, 20, stdin) && str[0] != '_') {
		int num = 0;
		int len = strlen(str) - 1;
		for (int i = 2; i < len; i++)
			if (str[i] == 'o') 
				num += a[i];
		printf("%c", num);
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值