HDU 4144 Bacon's Cipher
来源:互联网 发布:车螺纹编程实例 编辑:程序博客网 时间:2024/06/02 07:21
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4144
下午菜鸟杯比赛,这题就是菜鸟做的,表示各种用不惯VS,做了一半就回来了。
题目很简单,就是0可以当作任意字母,1可以看作任意数字,将字符串翻译后以5个字符为一组作为二进制。
再将二进制转化为十进制在进行数字与字母间的对应,输出字母。
代码:
#include<stdio.h>int main(){ char str[10001],a[1000001]; int i,n,k,len; while(scanf("%d",&n)!=EOF) { getchar(); for(i=1;i<=n;i++) { scanf("%c",&str[i]); if(str[i]>='0'&&str[i]<='9') { str[i]=1; } else { str[i]=0; } } for(k=0,i=1;i<=n;i+=5) { a[k++]=str[i]*2*2*2*2+str[i+1]*2*2*2+str[i+2]*2*2+str[i+3]*2+str[i+4]+'A'; } for(i=0;i<k;i++) { printf("%c",a[i]); } printf("\n"); } return 0;}
- HDU 4144 Bacon's Cipher
- HDU 4144 Bacon's Cipher
- hdu 4144 Bacon's Cipher
- HDU 4144Bacon's Cipher (解码)
- HDU4144:Bacon's Cipher
- hdu4144 Bacon's Cipher
- HDU4144 Bacon's Cipher
- HDU菜鸟杯比赛第二题Bacon's Cipher
- Bacon's Cipher hdu4144 水题
- 【字符串】hdu4144 Bacon's Cipher
- 17.04.29 Bacon's Cipher
- Ural 1590. Bacon’s Cipher 后缀数组
- 2011百校联动“菜鸟杯”程序设计公开赛&&Bacon's Cipher
- 1042 W's Cipher
- POJ_1107_W's Cipher
- hdu4144Bacon's Cipher
- POJ1107 W's Cipher
- ZOJ1042-W`s Cipher
- 获取xml文档中存储过程并执行(mysql)
- 实战Memcached缓存系统(4)Memcached的CAS协议
- 编程修养 阅读笔记一
- linux yum详解
- Windows平台下如何使用Android NDK
- HDU 4144 Bacon's Cipher
- win7权限注册表
- Servlet开发
- 编程注意事项个人总结
- android动画学习笔记
- new与malloc的区别
- 设计模式6大原则之迪米特法则
- 文件上传:SmartUpload和FileUpload .
- 关于写android音频方面的应用