UVa 10878 - Decode the tape

来源:互联网 发布:怎么查看端口是否关闭 编辑:程序博客网 时间:2024/05/16 01:41
Problem A
Decode the tape

Time Limit: 1 second

"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 InputSample Output
___________| 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 |___________
A quick brown fox jumps over the lazy dog.


Problemsetter: Igor Naverniouk
Special thanks: BSD games ppt.

 

 

 

#include <stdio.h>#include <string.h>int main(){    int a,p[8]={6,5,4,3,0,2,1,0};    char s[20];    while(gets(s)!=NULL)    {        if(s[0]=='|')        {            a=0;            for(int i=0;i<8;i++)            {                a|=(s[i+2]=='o')<<(p[i]);            }            printf("%c",a);        }    }    return 0;}