涨知识: UVA - 213 Message Decoding
来源:互联网 发布:怎样设计logo知乎 编辑:程序博客网 时间:2024/05/05 04:14
#include <map>#include<cstdlib>#include <cstdio>#include <string>#include <vector>#include <cstring>#include <fstream>#include <iostream>#include <algorithm>using namespace std; #define LOCAL//UVa213 M Decodingint readchar(){ for(;;){ int ch=getchar(); //if(ch!='\n' && ch !='\r') return ch; if(ch!='\n') return ch; }}int readint(int c){ int v=0; while(c--) v=v*2 + readchar()-'0'; return v;}int code[8][1<<8];int readcodes(){ memset(code,0,sizeof(code)); code[1][0]=readchar(); for(int len=2; len<=7; len++){ for(int i=0; i<(1<<len)-1; i++){ int ch=getchar(); if(ch==EOF) return 0; //if(ch=='\n' || ch=='\r') return 1; if(ch=='\n') return 1; code[len][i] =ch; } } return 1;}void printcodes(){ for(int len=1; len<8; len++) for(int i=0; i<(1<<len)-1; i++){ if(code[len][i]==0) return; printf("code[%d][%d] = %c\n",len,i,code[len][i]); }}int main(){#ifdef LOCAL freopen("in1.txt","r",stdin);#endif // LOCAL while(readcodes()){ //printcodes(); for(;;){ int len=readint(3); if(len==0) break; //printf("len=%d\n",len); for(;;){ int v=readint(len); //printf("v=%d\n",v); if(v==(1<<len)-1) break; putchar(code[len][v]); }//for }//for putchar('\n'); }//while return 0;}
字符串的读写问题一直都是我的弱项···
月底重刷
0 0
- 涨知识: UVA - 213 Message Decoding
- 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
- UVa 213 Message Decoding
- UVA 213 Message Decoding
- Message Decoding UVa 213
- Uva 213 Message Decoding
- UVa 213 - Message Decoding
- svn命令
- Leetcode 88. Merge Sorted Array 合并已排序数组
- rem和em的区别
- iot 表主键存放所有数据,且按数据插入顺序排序
- hdu1211(RSA)(扩展欧几里得+快速幂+快速乘)
- 涨知识: UVA - 213 Message Decoding
- matlab内存不足
- Python学习资源收集汇总
- android开发中eclipse里xml开发的自动提示和使用帮助快捷键提示
- gtk编译时错误
- C语言/C++编程题 之 时钟(分针追赶时针,分针与时针相遇次数问题)
- vim的vimrc文件备份
- 硬啃 :读完这100篇论文,你就能成大数据高手
- 死锁:哲学家进餐