Decode the tape
来源:互联网 发布:流放之路多线程cpu优化 编辑:程序博客网 时间:2024/05/29 14:12
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.
解题思路:解题时要先把注意力放在孔的分布规律上,看看小孔如何分布的,在哪些位置出现,然后联系后面已翻译的后的信息,在输出字符时,可以直接输出,也可以通过字符对应的ASCII码值输出,则其通过ASCII值输出时,要把小孔转化为对应ASCII值,根据其小孔分布位置,将一行小孔出现的位置表示为1,未出现位置表示为0,进行转化就可以得到对应的字母。其左边代表最高位,在翻译时每读入一行就翻译一次,在遇到“o”时就加上它在那位代表的值,最后输出这一行代表的字符就可以了。
#include<stdio.h> #include<string.h> int main() { char str[20]; int a,i,len; gets(str); while(gets(str)&&str[0]!='_') { a=0; len=strlen(str); for(i=2;i<len;i++) { if(str[i]=='o') { if(i==2) a+=64; else if(i==3) a+=32; else if(i==4) a+=16; else if(i==5) a+=8; else if(i==7) a+=4; else if(i==8) a+=2; else if(i==9) a+=1; } } printf("%c",a); } }
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- 10878 - Decode the tape
- UVa10878 Decode the tape
- 10878 - Decode the tape
- Decode the tape
- Decode the tape
- Decode the tape
- UVa10878 - Decode the tape
- Decode the tape
- 10878 - Decode the tape
- 316. Remove Duplicate Letters
- shiro学习笔记
- [IO]——文件的分割与合并
- C 【#include <> 和 #include "" 的区别】
- Jmeter安装和使用
- Decode the tape
- 十分简便的APK反编译(Mac 版本 详解)
- LinearLayout列表展示
- 【CodeForces】[1A]Theatre Square
- 第五届华中区程序设计邀请赛暨武汉大学第十四届校赛 网络预选赛
- Boost.Lockfree官方文档翻译
- 倒置和
- MyBatis初学注意点总结
- 神经网络机器翻译Neural Machine Translation(3): Achieving Open Vocabulary Neural MT