博客
关于我
算法提高 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/

你可能感兴趣的文章
myeclipse配置springmvc教程
查看>>
MyEclipse配置SVN
查看>>
MTCNN 人脸检测
查看>>
MyEcplise中SpringBoot怎样定制启动banner?
查看>>
MyPython
查看>>
MTD技术介绍
查看>>
MySQL
查看>>
MySQL
查看>>
mysql
查看>>
MTK Android 如何获取系统权限
查看>>
MySQL - 4种基本索引、聚簇索引和非聚索引、索引失效情况、SQL 优化
查看>>
MySQL - ERROR 1406
查看>>
mysql - 视图
查看>>
MySQL - 解读MySQL事务与锁机制
查看>>
MTTR、MTBF、MTTF的大白话理解
查看>>
mt_rand
查看>>
mysql -存储过程
查看>>
mysql /*! 50100 ... */ 条件编译
查看>>
mudbox卸载/完美解决安装失败/如何彻底卸载清除干净mudbox各种残留注册表和文件的方法...
查看>>
mysql 1264_关于mysql 出现 1264 Out of range value for column 错误的解决办法
查看>>