uva 10878 Decode the tape
来源:互联网 发布:人工智能毁灭人类例子 编辑:程序博客网 时间:2024/05/21 19:06
uva 10878 Decode the tape
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.
题目大意:题意很重要,每一行对应一个字符,o带表1,其他符号代表0,组成的字符的ASCLL码。
解题思路:每读取一行数据,对数据进行处理输出字符。(注意‘|’要处理,格式为(00000.000))
#include<stdio.h>#include<string.h>int ASCLL(int a) { //格式为|00000.000|,所以跳过0,6,10switch (a) {case 1:return 128;case 2:return 64;case 3:return 32;case 4:return 16;case 5:return 8;case 7:return 4;case 8:return 2;case 9:return 1;default:return 0;}}int main() {char s[20];memset(s, 0, sizeof(s));while (gets(s) != NULL) {int sum = 0;int len = strlen(s);if (s[0] != '|') continue; //开头结尾跳过for (int i = 0; i < len; i++) {if (s[i] == 'o') {sum += ASCLL(i);}}putchar(sum);}return 0;}
0 0
- UVa 10878 - Decode the tape
- uva 10878 Decode the tape
- uva-10878 - Decode the tape
- uva 10878 - Decode the tape
- UVa 10878 - Decode the tape
- Uva - 10878 - Decode the tape
- UVA 10878 - Decode the tape
- UVa 10878 - Decode the tape
- UVA 10878 - Decode the tape
- UVA 10878 Decode the tape
- UVa - 10878 - Decode the tape
- UVA 10878 Decode the tape
- uva 10878 Decode the tape
- UVa 10878 - Decode the tape
- uva 10878 decode the tape
- uva - 10878 - Decode the tape
- uva 10878 Decode the tape
- UVA 10878 Decode the tape
- 数据结构C语言实现之循环队列
- UVa 202 Repeating Decimals
- Trinea性能优化之实例
- Unity3D 学习教程 2 创建游戏工程与界面
- /etc/fonts/conf.d/44-wqy-zenhei.conf
- uva 10878 Decode the tape
- 时间复杂度的计算
- linux下实现两个线程之间的通信
- 再验证实验失败,小保方晴子未能制出万能细胞
- HDOJ Eddy's research II 1165
- Linux下c开发 之 线程通信(转)
- Android开源库获取途径整理
- HDU3342 Legal or Not【拓扑排序】【链式前向星】
- Phonegap获取程序版本插件开发