Decode the tapeTime
limit:MS
Memory Limit:0KB
64bit IO Format:%lld & %llu SubmitStatus
Description
"Machines take me by surprise with great frequency." |
Alan Turing
Your boss has just unearthed a roll of the old computer tapes. The tapes has holes in them and might contain some sort of useful information. It falls to the figure out what's written on them.
Input
The input would contain one tape.
Output
The Output of the message is written on the tape.
Sample Input
___________| O. o| | O. ||ooo. o| |ooo. o o| |ooO. o| |oo.oo||ooO.oo|| O. ||oo. O | |ooo. O | |ooo.ooo| |ooo. ooo| |ooo.oo | | O. ||oo. oo | |ooo.ooo| |oooo. || O. ||ooO. O | |ooo. o o| |ooO.O o| |ooo. ||ooo.oo|| O. ||ooo.ooo| |ooo. oo | |oo. o o| |ooo. O | | O. ||ooo. O | |ooO. | |oo. o o| | O. ||ooo.o | |oo. o| |oooo. O | |oooo. o| | O. ||oo. O | |ooo.ooo| |oo. ooo| | o O.oo | | O. o |___________
Sample Output
A quick brown fox jumps over the lazy dog.
Examine the binary code. Think O as 1, "(space) as 0, the rest do not need tube, but remember the second | To output the current character.
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> #include < Iostream>using namespace Std;int Main () { char str; int cnt=0; int sum=0; while ((Str=getchar ())!=eof) { if (str== ' o ') sum=sum*2+1; else if (str== ') sum=sum*2; else if (str== ' | ') { cnt++; if (cnt==2) { putchar (sum); cnt=0; Sum=0 ; }}} return 0;}
UVA 10878-decode the tape (analog)