UVA 10878-decode the tape (analog)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.