UVa 213 信息解码Message Decoding
来源:互联网 发布:上海it helpdesk招聘 编辑:程序博客网 时间:2024/04/30 13:23
不是难题,但卡了我一段时间
看了刘汝佳的书 慢慢的就明白了
主要由对编码串的处理构成 这部分相信大家看代码都能懂
AC代码(和书上差不多,但算是一个总结吧)
#include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>#include <algorithm>#include <vector>#include <map>using namespace std;char code[8][1<<8];int readchar(){ while(1) { int c=getchar(); if(c!='\n' && c!='\r') return c; }}int readlen(int l){ int v=0; while(l--) { v=v*2+readchar()-'0'; } return v;}int readcodes(){ memset(code,0,sizeof(code));//这一步第一次时掉了 code[1][0]=readchar(); for(int l=2;l<8;l++) { for(int u=0;u<(1<<l)-1;u++) { int buffer; buffer=getchar(); if(buffer==EOF) return 0; if(buffer=='\n' || buffer=='\r') return 1; code[l][u]=buffer; } } return 1;}int main(){ freopen("1.in","r",stdin); freopen("1.out","w",stdout); while(readcodes()) { while(1) { int len=readlen(3); if(len==0) break; while(1) { int kagamin=readlen(len); if(kagamin==(1<<len)-1) break; printf("%c",code[len][kagamin]); } } printf("\n"); } return 0;}
0 0
- UVa 213 Message Decoding (信息解码)
- Message Decoding 信息解码UVA 213
- UVa 213 信息解码Message Decoding
- 例题 4-4 信息解码 (Message Decoding) UVa 213
- UVa 213 Message Decoding (信息编码)
- 信息解码(Message Decoding, ACM/ICPC World Finals 1991, UVa 213)
- uva -213Message Decoding
- UVa 213 - Message Decoding
- UVA【213】 Message Decoding
- uva 213 Message Decoding
- UVA-213-Message Decoding
- UVa-213Message Decoding
- UVA - 213 Message Decoding
- Uva - 213 - Message Decoding
- UVA - 213 Message Decoding
- UVA 213 Message Decoding
- UVa 213 Message Decoding
- uva 213 Message Decoding
- spring boot 入门示例代码
- Groovy批处理命令
- 初学Android:数据存储技术小结
- Objective-C 数据持久化
- C++拷贝构造函数大全
- UVa 213 信息解码Message Decoding
- JavaScript面试大全1
- 设备管理命令
- AngularJS 国际化 支持记录语言刷新后语言不变
- Andorid App程序启动流程
- js中的正则表达式入门
- shell基础
- 波浪图
- CCF201512-3 画图(100分)