“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 mightcontain 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.

问题链接:UVA10878 Decode the tape。

题意简述:本题的题目是纸带编码。输入输入模仿过去的纸带,其中的"|"纸带里是没有的。纸带上信息有7位,通过穿孔实现,有孔的为1(用"o"表示),没孔的地方为0(用空格表示)。中间有一串空用于机械带动纸带,用"."表示。

问题分析:用输入数据模拟纸带数据。输入的数据放入输入缓冲区中,通常最左边的下标为0。而阿拉伯记数法中,低位在右,高位在左,纸带上的二进制数据也是如此。

程序说明:封装了函数mygets()用于代替库函数gets()(新标准中剔除了该函数)。程序中,根据位权从小到大进行处理,即从右到左(第9位-第1位),位权也逐步增大,需要跳过第6个字符(".")。

题记

阿兰·图林说:“机器的高频率令我震惊。”

最早的时候,计算机的数据及程序记录卡片上,后来出现了纸带。

AC的C语言程序如下:

/* UVA10878 Decode the tape */#include <stdio.h>#define MAXN 16int mygets(char s[])
{int i = 0;char c;while((c = getchar()) && c != '\n' && c != EOF)s[i++] = c;s[i] = '\0';return i;
}int main(void)
{int code, base, i;char s[MAXN];while(mygets(s)) {if(s[0] == '_')continue;code = 0;base = 1;for(i=9; i>=1; i--) {if(s[i] == 'o')code = code + base;if(i != 6)base <<= 1;}printf("%c", code);}return 0;
}

UVA10878 Decode the tape【编码】相关推荐

  1. python中decode的用法_python中list怎么使用decode方法设置编码

    Python decode() 方法以 encoding 指定的编码格式解码字符串.默认编码为字符串编码. decode()方法语法:str.decode(encoding='UTF-8',error ...

  2. 解码(decode)与编码(encode)(内附源代码)

    咱们接着上一篇的文章继续,深度学习编码与解码,简单易懂! # 解决乱码 # 编码乱码 :从网上获得的数据,我们就要根据他的编码格式进行解码 # 那么我们如何知道它的编码格式import request ...

  3. LeetCode 91 Decode Ways(编码方式)(*)

    原文 A message containing letters from A-Z is being encoded to numbers the following mapping: 'A' -> ...

  4. Competitive Programming 3题解

    题目一览: Competitive Programming 3: The New Lower Bound of Programming Contests(1) Competitive Programm ...

  5. Competitive Programming专题题解(1)

    Competitive Programming题解 AOAPC I: Beginning Algorithm Contests 题解 CP2-1.1.1 Easy(Ad Hoc Problems) P ...

  6. AOAPC I: Beginning Algorithm Contests 题解

    AOAPC I: Beginning Algorithm Contests 题解 AOAPC I: Beginning Algorithm Contests (Rujia Liu) - Virtual ...

  7. ICPC程序设计题解书籍系列之六:吴永辉:《算法设计编程实验》

    第1章 Ad Hoc问题 POJ2661 HDU1141 ZOJ2545 UVA10916 Factstone Benchmark[Ad Hoc] UVA10037 Bridge[贪心] POJ257 ...

  8. python解码函数_python2和python3的编码encode解码decode函数

    python比较坑的一个点:意义完全变了的两个函数 首先 常用的编码方式有3种,utf-8:  常用的传输和存储格式,Unicode的一种简化 Unicode:包括了所有可能字符的国际统一编码 GBK ...

  9. python的decode函数报错_python2和python3的编码encode解码decode函数

    python比较坑的一个点:意义完全变了的两个函数 首先 常用的编码方式有3种,utf-8:  常用的传输和存储格式,Unicode的一种简化 Unicode:包括了所有可能字符的国际统一编码 GBK ...

最新文章

  1. Eclipse快捷键详细解析
  2. springmvc DispatchServlet初始化九大加载策略(一)
  3. js操作HTML的select
  4. Apache Camel中的短重试与长重试
  5. c++ object model
  6. 知乎万赞:人并不是活一辈子,而是活几个瞬间
  7. 计算机二级考试基础知识文档,计算机二级公共基础知识(考试必考)
  8. CUDA库之NPP(二):NPP实现YUV转BGR
  9. excel切片器的用法
  10. Android开发:引入重复包报错Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDe...’解决方法
  11. 关于网络营销基本理论的概述
  12. 芯片数据分析步骤2 读取数据-affy
  13. 使用 HTML、CSS 和 JavaScript 定制私人版的刮刮乐【一看就会】
  14. java专业大学生入伍_JAVA程序征兵系统(包含登录系统和征兵系统)
  15. JAVA - JDK 环境配置
  16. Redux-Devtools调试工具安装使用
  17. 大数据之电商分析系统(一)
  18. 英语六级真题高频词汇之阅读
  19. 快手如何直播引流?快手直播推广方法分享
  20. 6G定位的潜力与挑战

热门文章

  1. 发布一套IOCP框架
  2. Android集成百度地图
  3. weui上传组件的图片封装到formdata_自定义toast-ui富文本组件的图片黏贴上传
  4. 剑指offer面试题05. 替换空格
  5. Linux基础——Linux 基本指令 ls 和 cd
  6. LeetCode 70.爬楼梯(动态规划)
  7. 三维重建:三维重建技术概述
  8. C++中数组、链表list、容器map/vector的区别
  9. 服务器2008r2网络禁止修改,windows-server-2008-r2 – Windows 2008 R2标准服务器 – 如何禁用RC4...
  10. thikPHP框架部署