#include<stdio.h>
#include<math.h>
#include<string.h>
char s[250];
char a[10][250];
int a1[4];
int a2[250];
char ch; int init(int len)
{
int tt=0;
for(int i=1;i<=7;i++)
{
for(int j=0;j<(int)pow(2,i)-1;j++)
{
a[i][j]=s[tt++];
if(tt>=len)
break;
}
if(tt>=len)
break;
}
} int tran(int *aa,int len)
{
int temp=0;
for(int i=len-1,j=0; i>=0; i--,j++)
{
temp+=(int)aa[i]*pow(2,j);
}
return temp;
} int main()
{
while(gets(s)!=NULL)
{
memset(a,0,sizeof(a));
int len=strlen(s);
init(len); while(1)
{
int t2=0;
while(t2<3)
{
scanf("%c",&ch);
if(ch=='1'||ch=='0')
{
a1[t2]=ch-'0';
t2++;
}
}
int lenth=tran(a1,3);
if(lenth==0)
{
scanf("%c",&ch);
printf("\n");
break;
}
while(1)
{
int t3=0;
while(t3<lenth)
{
scanf("%c",&ch);
if(ch=='1'||ch=='0')
{
a2[t3]=ch-'0';
t3++;
}
}
int ans=tran(a2,lenth);
if(ans!=(int)pow(2,lenth)-1)
printf("%c",a[lenth][ans]);
else
break;
}
}
}
return 0;
}

uva 213 - Message Decoding (我认为我的方法要比书上少非常多代码,不保证好……)的更多相关文章

  1. UVa 213 Message Decoding(World Finals1991,串)

     Message Decoding  Some message encoding schemes require that an encoded message be sent in two part ...

  2. UVA 213 Message Decoding 【模拟】

    题目链接: https://cn.vjudge.net/problem/UVA-213 https://uva.onlinejudge.org/index.php?option=com_onlinej ...

  3. uva 213 Message Decoding

    思路来自紫书...开始时的思路估计100行+,果断放弃!关键:1.正确提取出函数!   initmap():初始化字母与整数的映射.   returnint(x):向后读取x位,并转换为十进制数返回. ...

  4. UVA - 213 Message Decoding (输入字符串并对单个字符进行操作的输入输出)

    POINT: 关于表示一个编码:利用code字符数组表示一个编码字符,其中code[len][val]表示长度为len,二进制值为val的字符: 主程序如下: #include <iostrea ...

  5. 【每日一题】 UVA - 213 Message Decoding 模拟解码+读入函数+阅读题

    题意:阅读理解难度一道比一道难orz.手摸了好久样例 题解: 读入:大循环用getline读入header顺便处理一下,  里面再写两重循环,外层一次读三个串,内层一次读num个串. 之后就查表,线性 ...

  6. uvaoj 213 - Message Decoding(二进制,输入技巧)

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  7. Message Decoding UVA - 213

     Some message encoding schemes require that an encoded message be sent in two parts. The fifirst par ...

  8. 【例题 4-4 uva 213】Message Decoding

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 输入的二进制长度最长为7 所以得开个sta[7][2^7]的样子才存的下所有的字符的.. 定义这么一个数组当字典. 然后一个字符一个 ...

  9. UVa 213,World Finals 1991,信息解码

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

随机推荐

  1. 【SPFA判断负环】BZOJ1715- [Usaco2006 Dec]Wormholes 虫洞

    [题目大意] 判断一张图中是否存在负环. [思路] dfs版SPFA. #include<bits/stdc++.h> using namespace std; struct edge { ...

  2. [BJOI2010]次小生成树

    OJ题号: BZOJ1977.COGS2453 题目大意: 给你一个无向连通图,求严格次小生成树. 思路: 对于一般次小生成树,我们有一个结论:一般次小生成树一定可以通过替换掉最小生成树某一条边得到. ...

  3. 批量导入--EasyPOIPOI

    easypoi功能如同名字easy,主打的功能就是容易,让一个没见接触过poi的人员 就可以方便的写出Excel导出,Excel模板导出,Excel导入,Word模板导出,通过简单的注解和模板 语言( ...

  4. Codeforces Round #294 (Div. 2)A - A and B and Chess 水题

    A. A and B and Chess time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #280 (Div. 2) D. Vanya and Computer Game 预处理

    D. Vanya and Computer Game time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  6. Mac OSX系统下通过ProxyChains-NG实现终端下的代理

    项目主页:https://github.com/rofl0r/proxychains-ng 官方说明: proxychains ng (new generation) - a preloader wh ...

  7. Spring Batch 批处理框架介绍

    前言 在大型的企业应用中,或多或少都会存在大量的任务需要处理,如邮件批量通知所有将要过期的会员,日终更新订单信息等.而在批量处理任务的过程中,又需要注意很多细节,如任务异常.性能瓶颈等等.那么,使用一 ...

  8. 编写简单登陆和注册功能的demo时遇到的问题

    一.注册功能中添加数据不成功 给数据库添加EditText中的内容后,数据库中找不到添加后的数据,并且存在字符串为空的数据 解决方法:EditText registerAccount = (EditT ...

  9. Solaris10 下mysql5.5.12的安装

    http://blog.csdn.net/ocean20/article/details/6417845 http://howtolamp.com/lamp/mysql/5.6/installing/

  10. 使用Lazy<T>实现对客户订单的延迟加载

    "延迟加载"是指在需要的时候再加载数据.比如获得一个Customer信息,并不会把该Customer的Orders信息一下加载出来,当需要显示Orders的时候再加载.简单来说,就 ...