UVa213-Message Decoding
2017-08-18 15:02
225 查看
UVa213-Message Decoding
思路:
紫书上的题目刚开始没有把各个功能独立开来能想到的例子都过了但是提交就RE,卡了巨长时间最后无奈按照书上思路把各个功能独立出来,一边过。无奈代码:
#include <bits/stdc++.h> using namespace std; char ve[8][1<<9+1]; char getcha() { int ch; while(ch=getchar()) { if(ch!='\n'&&ch!='\t') return ch; } } int getnum(int n) { int num=0; while(n--) num=num*2+getcha()-'0'; return num; } int gethead() { char ch[100001]; int k=0; memset(ve,0,sizeof(ve)); if(scanf("%[^\n]",ch)==-1) return 0; for(int i=1;;i++) { for(int j=0;j<(1<<i)-1;j++,k++) { if(!ch[k]) return 1; ve[i][j]=ch[k]; } } return 1; } int main() { int n; while(gethead()) { while(n=getnum(3),n) { int ans; while(1) { ans=getnum(n); if(ans==(1<<n)-1)break; printf("%c",ve [ans]); } } printf("\n"); getchar(); } }
相关文章推荐
- UVA213----Message Decoding
- UVa 213 Message Decoding(World Finals1991,字符串)
- Message Decoding (UVA-213)
- uva 213
- UVa213 Message Decoding
- UVa213
- 算法竞赛入门经典java版程序ch4 UVa213
- UVa213 - Message Decoding
- uva 213 Message Decoding
- 算法竞赛入门经典(第二版) 例题4-4 信息编码(Message Decoding) UVa213 Finals1991 (二进制)
- UVA213 Message Decoding(二进制)
- UVA213 UVALive5152 Message Decoding【密码】
- UVA_213: Message Decoding
- UVA 213 Message Decoding 【模拟】
- UVa 213 Message Decoding(World Finals1991,串)
- UVa 213 Message Coding
- UVa 213 Message Decoding (信息解码)
- UVa 213 Message Decoding (信息编码)
- UVA 213 Message Decoding 【模拟】
- UVa213 Message Decoding