算法之路二:刘汝佳算法竞赛入门经典 信息解码 UVA213
来源:互联网 发布:zip mac怎么解压软件 编辑:程序博客网 时间:2024/05/18 01:53
#include<stdio.h>#include<string.h>int readchar();int readint(int c);int code[8][1<<8];int readcodes();int main(){ 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]); } } putchar('\n'); } return 0; } int readchar() { for(;;) { int ch=getchar(); if(ch!='\n'&&ch!='\r') return ch; } } int readint(int c) { int v=0; while(c--) v=v*2+readchar()-'0'; return v; } 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; code[len][i]=ch; } } return 1; } void printcodes() { for(int len=1;len<=7;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]); } }
???
0 0
- 算法之路二:刘汝佳算法竞赛入门经典 信息解码 UVA213
- 算法竞赛入门经典 UVa213 Message Decoding
- 算法竞赛入门经典java版程序ch4 UVa213
- 算法竞赛入门经典(第二版) 例题4-4 信息编码(Message Decoding) UVa213 Finals1991 (二进制)
- 算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 信息解码
- 算法之路二:刘汝佳算法竞赛入门经典 3.2开灯问题
- 算法之路二:刘汝佳算法竞赛入门经典 3.3蛇形填数
- 算法之路二:刘汝佳算法竞赛入门经典 3.4竖式问题
- 算法之路二:刘汝佳算法竞赛入门经典 3.5Tex中的引号 UVa272
- 算法之路二:刘汝佳算法竞赛入门经典 3.6WERTYU UVa10082
- 算法之路二:刘汝佳算法竞赛入门经典 3.7回文词 UVa401
- 算法之路二:刘汝佳算法竞赛入门经典 3.8猜数字游戏 UVa340
- 算法之路二:刘汝佳算法竞赛入门经典 3.9生成元 UVa1583
- 算法之路二:刘汝佳算法竞赛入门经典 3.10环状序列 UVa1584
- 算法之路二:刘汝佳算法竞赛入门经典 组合数和素数判定
- 算法之路二:刘汝佳算法竞赛入门经典 计算数组元素和
- 算法之路二:刘汝佳算法竞赛入门经典 4.11刽子手游戏 UVa 489
- 算法之路二:刘汝佳算法竞赛入门经典 救济金发放 UVa133
- 网络复习笔记
- 用JavaScript做表单的校验
- NOI 2016 优秀的拆分 后缀数组
- vtk中的BMP图像读取
- 华为机试在线训练-牛客网(8)句子逆序
- 算法之路二:刘汝佳算法竞赛入门经典 信息解码 UVA213
- 网络安全的专家—防火墙!!续
- Linux tomcat根据物理内存大小动态配置JVM内存
- Linux SPI总线和设备驱动架构之三:SPI控制器驱动
- [Codeforces Round #354 DIV2D (CF676D)] Theseus and labyrinth
- SqlMap用户手册
- PHP基础之数据类型、单双引号区别和定界符
- 短信验证码之签名和模板
- 猫哥带你去战斗——Java Web开发——网页篇[3]——继续基本标签