UVA 10878 Decode the tape
来源:互联网 发布:崔永元 我的抗战 知乎 编辑:程序博客网 时间:2024/05/23 00:04
C - Decode the tape
Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluDescription
"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.
题目解析:
'A' = 64+0+0+0+0+0+1
' ' = 0+32+0+0+0+0+0
'q' = 64+32+16+0+0+0+1
'u' = 64+32+16+0+4+0+1
‘i’ = 64+32+0+8+0+0+1
从以上顺序可得出,密码是按照ASCII码
#include <stdio.h> #include <string.h> int c[] = { 0, 0, 64, 32, 16, 8, 0, 4, 2, 1, 0}; int main() { char str[15]; int sum,i; gets(str); while(gets(str) && str[0] != '_'){ sum = 0; int len = strlen(str); for(i = 2;i < len;i++){ if(str[i] == 'o'){ sum += c[i]; } } printf("%c",sum); } }
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
- SqlServer 并发系列之读写分离
- 黑马程序员---面向对象概述
- IdleHandler一个后娘养的handler
- Asteroids
- 关于使用xib的自定义UITableViewCell中修改其中view的问题及解决
- UVA 10878 Decode the tape
- SimpleDateFormat设置24小时制
- Hibernate多对一遍历对象的时候报java.lang.StackOverflowError错误
- 生活连接
- 初学者php
- Crontab 实现定时执行一个shell脚本(以每隔十分钟执行一次为例)
- 部分CSS缩写
- swf 嵌入 jsp 中
- Java IO的RandomAccessFile的使用