UVA213 UVALive5152 Message Decoding
来源:互联网 发布:中岛健人 知乎 编辑:程序博客网 时间:2024/06/06 01:48
World Finals >> 1991 - San Antonio
问题链接:UVA213 UVALive5152 Message Decoding。
问题简述:参见问题链接。
问题分析:(略)。
程序中,若干功能封装到函数中,使得程序逻辑变得简洁。
AC的C语言程序如下:
/* UVA213 UVALive5152 Message Decoding */#include <stdio.h>#include <memory.h>#define CODE_LEN 7int code[CODE_LEN+1][1<<(CODE_LEN+1)];int readchar(){ int c; while((c=getchar()) && (c == '\n' || c == '\r')); return c;}int readcodes(){ int i, j; char c; memset(code, 0, sizeof(code)); code[1][0] = readchar(); for(i=2; i<=CODE_LEN; i++) { int len = (1<<i)-1; for(j=0; j<len; j++) { if((c = getchar()) == EOF) return 0; else if(c == '\n' || c == '\r') return 1; code[i][j] = c; } } return 1;}int readint(int len){ int v = 0; while(len--) v = v * 2 + readchar() - '0'; return v;}int main(void){ while(readcodes()) { for(;;) { int len = readint(3); if(len == 0) break; for(;;) { int v = readint(len); if(v == (1 << len) - 1) break; putchar(code[len][v]); } } putchar('\n'); } return 0;}
1 0
- UVA213 UVALive5152 Message Decoding
- UVA213 - Message Decoding
- UVa213 Message Decoding
- UVa213 - Message Decoding
- UVA213----Message Decoding
- UVa213-Message Decoding
- UVa213 Message Decoding
- UVa213 Message Decoding
- UVA213 Message Decoding(二进制)
- 水题:UVa213- Message Decoding
- 算法竞赛入门经典 UVa213 Message Decoding
- Message Decoding
- Message Decoding
- 算法竞赛入门经典(第二版) 例题4-4 信息编码(Message Decoding) UVa213 Finals1991 (二进制)
- uva -213Message Decoding
- UVa 213 - Message Decoding
- UVaOJ-213 Message Decoding
- UVA【213】 Message Decoding
- ContentProvider详解2
- 动力学,手把手的搞动画
- 【面试】C++多态问题集锦
- HTML-链接简介
- Vim 快捷键
- UVA213 UVALive5152 Message Decoding
- CAS实现SSO单点登录原理
- 自定义注解
- Ubuntu下mysql的各种安装方式
- ContentProvider详解3
- POJ3069
- uva230-Borrowers
- Linux下系统实时监控
- 注解总结