UVa213

来源:互联网 发布:手机app软件下载 编辑:程序博客网 时间:2024/05/22 16:47
#define LOCAL0#include <stdlib.h>#include <stdio.h>#include "iostream"#include "sstream"#include <string.h>#include <cmath>#define inf 0x3f3f3f3fusing namespace std;char tbl[8][(1<<7)-1];int getCode(char *s, int &pos, int len){int tot=0;char ch;while(len){ch=s[pos++];tot=tot+(ch-'0')*int(pow(2,len-1));--len;}return tot;}int main(){    #ifdef LOCAL    freopen("input.txt","r",stdin);    //freopen("output.txt","w",stdout);    #endif    int i,n,ch;    memset(tbl,0,sizeof(tbl));    for(i=1;i<8;i++){    for(n=0;n<int(pow(2,i)-1);n++){    if((ch=getchar())!='\n')    tbl[i][n]=ch;    else break;    }    if(ch=='\n') break;    }    int l,pos=0,k;    char s[1024];    scanf("%s",s);    while((l=getCode(s,pos,3))!=0){    while((k=getCode(s,pos,l))!=int(pow(2,l)-1)){    cout<<tbl[l][k];    }    putchar('\n');    }    printf("END\n");        return 0;}

0 0
原创粉丝点击