10878 - Decode the tape
Time limit: 3.000 seconds
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=1819
"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.
___________ | 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 | ___________
多看看磁带吧。
完整代码:
#include<cstdio> #include<cstdlib> char str[11], num[8], *endstr; int main(void) { gets(str); while (gets(str), str[1] != '_') { int i; for (i = 2; i <= 5; ++i) num[i - 2] = (str[i] == 'o' ? '1' : '0'); for (i = 7; i <= 9; ++i) num[i - 3] = (str[i] == 'o' ? '1' : '0'); num[7] = '\0'; putchar(strtol(num, &endstr, 2)); } return 0; }
查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索include
, 趣题
, str
, contain
, OO
, #OO
, The
1819
decode the message、decode、urldecode、json decode、decode函数,以便于您获取更多的相关知识。