博客
关于我
算法提高 9-3摩尔斯电码 map
阅读量:445 次
发布时间:2019-03-06

本文共 1476 字,大约阅读时间需要 4 分钟。

算法提高 9-3摩尔斯电码  
时间限制:1.0s   内存限制:256.0MB
   
问题描述
  摩尔斯电码破译。类似于乔林教材第213页的例6.5,要求输入摩尔斯码,返回英文。请不要使用"zylib.h",只能使用标准库函数。用' * '表示' . ',中间空格用' | '表示,只转化字符表。
  摩尔斯码定义见:http://baike.baidu.com/view/84585.htm?fromId=253988。
提示
  清橙进行评测时,输入是以EOF结尾的,而不是换行符。(EOF不是一个字符,“以EOF结尾”是一种通俗但不严谨的说法。)因此可以通过以下方式之一获取输入:
  1. 一次读入整行字符串,再进行后续解析。
  2. 使用getchar或scanf一次读入一个字符,通过它们的返回值判断输入结束。
样例输出

代码:

#include
#include
#include
#include
#include
using namespace std;map
Map;void init(){ Map.insert(make_pair("*-",'a')); Map.insert(make_pair("-***",'b')); Map.insert(make_pair("-*-*",'c')); Map.insert(make_pair("-**",'d')); Map.insert(make_pair("*",'e')); Map.insert(make_pair("**-*",'f')); Map.insert(make_pair("--*",'g')); Map.insert(make_pair("****",'h')); Map.insert(make_pair("**",'i')); Map.insert(make_pair("*---",'j')); Map.insert(make_pair("-*-",'k')); Map.insert(make_pair("*-**",'l')); Map.insert(make_pair("--",'m')); Map.insert(make_pair("-*",'n')); Map.insert(make_pair("---",'o')); Map.insert(make_pair("*--*",'p')); Map.insert(make_pair("--*-",'q')); Map.insert(make_pair("*-*",'r')); Map.insert(make_pair("***",'s')); Map.insert(make_pair("-",'t')); Map.insert(make_pair("**-",'u')); Map.insert(make_pair("***-",'v')); Map.insert(make_pair("*--",'w')); Map.insert(make_pair("-**-",'x')); Map.insert(make_pair("-*--",'y')); Map.insert(make_pair("--**",'z'));}int main(){ string s; init(); cin>>s; int len=s.length(); int l=0,r=0; while(r

转载地址:http://mpjyz.baihongyu.com/

你可能感兴趣的文章
MSTP是什么?有哪些专有名词?
查看>>
Mstsc 远程桌面链接 And 网络映射
查看>>
Myeclipse常用快捷键
查看>>
MyEclipse更改项目名web发布名字不改问题
查看>>
MyEclipse用(JDBC)连接SQL出现的问题~
查看>>
mt-datetime-picker type="date" 时间格式 bug
查看>>
myeclipse的新建severlet不见解决方法
查看>>
MyEclipse设置当前行背景颜色、选中单词前景色、背景色
查看>>
Mtab书签导航程序 LinkStore/getIcon SQL注入漏洞复现
查看>>
myeclipse配置springmvc教程
查看>>
MyEclipse配置SVN
查看>>
MTCNN 人脸检测
查看>>
MyEcplise中SpringBoot怎样定制启动banner?
查看>>
MyPython
查看>>
MTD技术介绍
查看>>
MySQL
查看>>
MySQL
查看>>
mysql
查看>>
MTK Android 如何获取系统权限
查看>>
MySQL - 4种基本索引、聚簇索引和非聚索引、索引失效情况、SQL 优化
查看>>