UVA 10878 - Decode the tape
来源:互联网 发布:ios 取出数组相同元素 编辑:程序博客网 时间:2024/05/16 01:18
很有趣的题目,其实每一行都是一个字母的ASCII码的二进制表示,o表示1 空格表示0
#include <iostream>#include <string>#include <memory.h>#include <cstdio>using namespace std;const int conPow[]={1,2,4,8,16,32,64,128,256,512};char buf[100];char toDecimal(string & str){char v=0;for (int i=str.size()-1;i>=0;--i){v=v+(str[i]-'0')*(conPow[str.size()-i-1]);}return v;}int main(){gets(buf);while (gets(buf)&&strcmp(buf,"___________")){string bin="";int len=strlen(buf);for (int i=0;i<len;++i){if(buf[i]==' ')bin+='0';else if(buf[i]=='o')bin+='1'; }printf("%c",toDecimal(bin));}return 0;}
- UVa 10878 - Decode the tape
- uva 10878 Decode the tape
- uva-10878 - Decode the tape
- uva 10878 - Decode the tape
- UVa 10878 - Decode the tape
- Uva - 10878 - Decode the tape
- UVA 10878 - Decode the tape
- UVa 10878 - Decode the tape
- UVA 10878 - Decode the tape
- UVA 10878 Decode the tape
- UVa - 10878 - Decode the tape
- UVA 10878 Decode the tape
- uva 10878 Decode the tape
- UVa 10878 - Decode the tape
- uva 10878 decode the tape
- uva - 10878 - Decode the tape
- uva 10878 Decode the tape
- UVA 10878 Decode the tape
- 如何将Oracle数据库的普通表转换成分区表
- 串口调试助手源程序 及编程详细过程
- hibernate Example、Criteria 查询
- Telnet 命令
- 串口调试助手 及编程详细过程(二)
- UVA 10878 - Decode the tape
- flex的Socket通信
- 安装SqlServer2008有感
- UVA 10851 - 2D Hieroglyphs decoder
- DataGridView实现点击左边空白部分选中行,并对其进行操作
- 微软开始犯贱了,一开机就访问论坛。
- 35个非常酷的wordpress全屏的Slide主题
- ERROR:Class 'Log' not found thinkphp
- 安全模式和普通模式