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

你可能感兴趣的文章
mysql5.7 for windows_MySQL 5.7 for Windows 解压缩版配置安装
查看>>
Webpack 基本环境搭建
查看>>
mysql5.7 安装版 表不能输入汉字解决方案
查看>>
MySQL5.7.18主从复制搭建(一主一从)
查看>>
MySQL5.7.19-win64安装启动
查看>>
mysql5.7.19安装图解_mysql5.7.19 winx64解压缩版安装配置教程
查看>>
MySQL5.7.37windows解压版的安装使用
查看>>
mysql5.7免费下载地址
查看>>
mysql5.7命令总结
查看>>
mysql5.7安装
查看>>
mysql5.7性能调优my.ini
查看>>
MySQL5.7新增Performance Schema表
查看>>
Mysql5.7深入学习 1.MySQL 5.7 中的新增功能
查看>>
Webpack 之 basic chunk graph
查看>>
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>