Decode the tape - UVa 10878 找规律

来源:互联网 发布:qq农场刷级软件 编辑:程序博客网 时间:2024/04/29 14:31

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.



题意:解码。

思路:7位的二进制。

AC代码如下:

#include<cstdio>#include<cstring>using namespace std;char str[100];int main(){ gets(str);  while(true)  { gets(str);    if(str[2]=='_')     break;    else    { int k=0;      if(str[9]=='o')       k+=1;      if(str[8]=='o')       k+=2;      if(str[7]=='o')       k+=4;      if(str[5]=='o')       k+=8;      if(str[4]=='o')       k+=16;      if(str[3]=='o')       k+=32;      if(str[2]=='o')       k+=64;      printf("%c",k);    }  }}



0 0
原创粉丝点击