当前位置: 首页 > news >正文

网站建设问题及解决办法网站建设营销推广

网站建设问题及解决办法,网站建设营销推广,黄山景区的网站做的怎么样,一手货源怎么找赛题介绍 挑战介绍 曾公亮编撰的《武经总要》中记载了一套严谨的军事通信密码,这也是目前发现我国古代战争中最早使用的军用密码表。将战场上可能常用到的情况,用 40 个短语归纳表示,且每个短语前编有固定的数字代码,这 40 个短…

赛题介绍

挑战介绍

曾公亮编撰的《武经总要》中记载了一套严谨的军事通信密码,这也是目前发现我国古代战争中最早使用的军用密码表。将战场上可能常用到的情况,用 40 个短语归纳表示,且每个短语前编有固定的数字代码,这 40 个短语及数字代码如下:

代码短语代码短语代码短语代码短语代码短语
1请弓2请箭3请刀4请甲5请枪旗
6请锅幕7请马8请衣赐9请粮料10请草料
11请车牛12请船13请攻城守县14请添兵15请移营
16请进军17请退军18请固定19未见军20见贼
21贼多22贼少23贼相敌24贼添兵25贼移营
26贼进军27贼退军28贼固守29围得贼城30解围城
31被贼围32贼围解33战不胜34战大胜35战大捷
36将士投降37将士叛38士卒病39部将病40战小胜

然后约定某一首五言古诗作为解密的钥匙,五言古诗中 40 个字正好对应密码表中 40 种情况。

例如约定唐代王勃的《送杜少府之任蜀川》为解密的钥匙。

城阙辅三秦,风烟望五津。

与君离别意,同是宦游人。

海内存知己,天涯若比邻。

无为在歧路,儿女共沾巾。

如果军中马匹不足,需要请求马匹,那么对应密码表中的情报则是:7、请马。而《送杜少府之任蜀川》中第 7 个字是烟,将军只需要将“烟”字写到 一件普通公文书牒之中,并在字上加盖印章。朝廷收到公文书牒后通过《送杜少府之任蜀川》确认“烟”字的位置,然后查找密码表,获得相应的情报。

挑战目标

补充文件  zeng_gongliang.py  下  zeng_gongliang_decryption(text)  函数中的 TODO 部分,使其实现我们需要的功能:

  • 输入古诗《送杜少府之任蜀川》中任意一个字,返回曾公亮密码表中对应的短语。
  • 如果输入的内容在古诗《送杜少府之任蜀川》的 40 个 字中查找不到,则返回 None。
  • 其它情况全部返回 None。
def zeng_gongliang_decryption(text: str) -> str:"""TODO"""key_dict = {'1':'请弓', '2':'请箭', '3':'请刀', '4':'请甲', '5':'请枪旗', '6':'请锅幕', '7':'请马', '8':'请衣赐', '9':'请粮料', '10':'请草料', '11':'请车牛', '12':'请船', '13':'请攻城守县', '14':'请添兵', '15':'请移营', '16':'请进军', '17':'请退军', '18':'请固定', '19':'未见军', '20':'见贼', '21':'贼多', '22':'贼少', '23':'贼相敌', '24':'贼添兵', '25':'贼移营', '26':'贼进军', '27':'贼退军', '28':'贼固守', '29':'围得贼城', '30':'解围城', '31':'被贼围', '32':'贼围解', '33':'战不胜', '34':'战大胜', '35':'战大捷', '36':'将士投降', '37':'将士叛', '38':'士卒病', '39':'部将病', '40':'战小胜'} decryption_text : str = ''return decryption_text

挑战要求

  • 题目需使用 Python3 完成,不能使用标准库和第三方库。
  • 函数传入 text 为字符串类型,可能为空、None 等值。
  • 不得修改文件路径、文件名 zeng_gongliang.py 以及函数名 zeng_gongliang_decryption(text)
  • 请只保留文件 zeng_gongliang.py 及文件中函数,不要添加测试或执行代码,避免检测时出错。
  • 线上环境调试代码时,请使用 python3 zeng_gongliang.py 命令调用 Python3。

参考样例

# 样例 1
text = "烟"; decryption_text = "请马"
# 样例 2
text = "城"; decryption_text = "请弓"
# 样例 3
text = "请弓"; decryption_text = None
# 样例 4
text = "城 "; decryption_text = None
# 样例 5
text = None; decryption_text = None

注意:最终实现效果以完全满足要求为准,而不是仅满足如上样例。


题解

解题思路

主要考察字典dict结构及方法的运用

  1. 要注意对传入参数类型的检查,包括空字符串等情形。
  2. 构造索引字符串。
  3. 利用index()方法寻找某个字符的索引.
  4. 过滤不存在的键值,返回None
  5. 最后使用get方法从字典找到对应的字符串值返回即可。
def zeng_gongliang_decryption(text: str) -> str:"""TODO"""# 过滤非str类型输入if not isinstance(text, str) or text == "":return None# 仅一个字符输入限制if len(text) > 1:return None# 构造数据字典key_dict = {'1': '请弓', '2': '请箭', '3': '请刀', '4': '请甲', '5': '请枪旗','6': '请锅幕', '7': '请马', '8': '请衣赐', '9': '请粮料', '10': '请草料','11': '请车牛', '12': '请船', '13': '请攻城守县', '14': '请添兵', '15': '请移营', '16': '请进军', '17': '请退军', '18': '请固定', '19': '未见军', '20': '见贼','21': '贼多', '22': '贼少', '23': '贼相敌', '24': '贼添兵', '25': '贼移营','26': '贼进军', '27': '贼退军', '28': '贼固守', '29': '围得贼城', '30':'解围城','31': '被贼围', '32': '贼围解', '33': '战不胜', '34': '战大胜','35': '战大捷','36': '将士投降', '37': '将士叛', '38': '士卒病', '39': '部将病', '40': '战小胜'}poem = "城阙辅三秦风烟望五津与君离别意同是宦游人海内存知己天涯若比邻无为在歧路儿女共沾巾"if text in poem:num = poem.index(text) + 1if key_dict.get(str(num)) == None:return Noneelse:return Nonedecryption_text: str = key_dict.get(str(num))return decryption_text

题目来源:蓝桥破解曾公亮密码


文章转载自:
http://dinncochoora.tpps.cn
http://dinncoslovensko.tpps.cn
http://dinncopermanence.tpps.cn
http://dinncotoyon.tpps.cn
http://dinncosignalment.tpps.cn
http://dinncoapproximator.tpps.cn
http://dinncoprosthesis.tpps.cn
http://dinncoerectormuscle.tpps.cn
http://dinncostentor.tpps.cn
http://dinncoamassment.tpps.cn
http://dinncobackbiting.tpps.cn
http://dinncobronchoconstriction.tpps.cn
http://dinncoheehaw.tpps.cn
http://dinncosubastral.tpps.cn
http://dinncobutyrinase.tpps.cn
http://dinncounadulterated.tpps.cn
http://dinncofireballer.tpps.cn
http://dinncoaccusable.tpps.cn
http://dinncoluetin.tpps.cn
http://dinncoaccusatival.tpps.cn
http://dinncoandromonoecious.tpps.cn
http://dinncocreatine.tpps.cn
http://dinncounifacial.tpps.cn
http://dinncomarshman.tpps.cn
http://dinncovigia.tpps.cn
http://dinncovim.tpps.cn
http://dinncolube.tpps.cn
http://dinncoujamaa.tpps.cn
http://dinncowashaway.tpps.cn
http://dinncorhizophilous.tpps.cn
http://dinncoimmurement.tpps.cn
http://dinncotinea.tpps.cn
http://dinncolevin.tpps.cn
http://dinncosequacious.tpps.cn
http://dinncoforerunner.tpps.cn
http://dinncohydrosere.tpps.cn
http://dinncoestipulate.tpps.cn
http://dinncouruguayan.tpps.cn
http://dinncobibliograph.tpps.cn
http://dinncolangobardic.tpps.cn
http://dinncomyelinated.tpps.cn
http://dinncoformulizer.tpps.cn
http://dinncoafghanistani.tpps.cn
http://dinncoupton.tpps.cn
http://dinncoendodontics.tpps.cn
http://dinncociceroni.tpps.cn
http://dinncoscavenge.tpps.cn
http://dinncohospitium.tpps.cn
http://dinncozithern.tpps.cn
http://dinncotriphammer.tpps.cn
http://dinncobiennially.tpps.cn
http://dinncodevolutionist.tpps.cn
http://dinncowreak.tpps.cn
http://dinncosolaceful.tpps.cn
http://dinncocontrabandage.tpps.cn
http://dinncosacrum.tpps.cn
http://dinncotentaculiferous.tpps.cn
http://dinncovacationist.tpps.cn
http://dinncodiverticulum.tpps.cn
http://dinncosinglehanded.tpps.cn
http://dinncooutskirts.tpps.cn
http://dinncocrunchy.tpps.cn
http://dinncoacanthocephalan.tpps.cn
http://dinncomagnesium.tpps.cn
http://dinncoroomily.tpps.cn
http://dinncoconclusive.tpps.cn
http://dinncoscatty.tpps.cn
http://dinncohorsewoman.tpps.cn
http://dinncoamphitheatric.tpps.cn
http://dinncoradiotherapeutics.tpps.cn
http://dinncowhosoever.tpps.cn
http://dinncoabiotrophy.tpps.cn
http://dinncogrammatology.tpps.cn
http://dinncodoorcase.tpps.cn
http://dinncolochial.tpps.cn
http://dinncoconcretion.tpps.cn
http://dinncomnas.tpps.cn
http://dinncoredball.tpps.cn
http://dinncosquish.tpps.cn
http://dinncosentimo.tpps.cn
http://dinncocad.tpps.cn
http://dinnconarcissus.tpps.cn
http://dinncomissel.tpps.cn
http://dinncolaster.tpps.cn
http://dinncosoundboard.tpps.cn
http://dinncocapper.tpps.cn
http://dinncoiosb.tpps.cn
http://dinncoraob.tpps.cn
http://dinnconor.tpps.cn
http://dinncosnig.tpps.cn
http://dinncoagranulocyte.tpps.cn
http://dinncoexpansionist.tpps.cn
http://dinncoflamethrower.tpps.cn
http://dinncochiaroscurist.tpps.cn
http://dinncoheterography.tpps.cn
http://dinncoprintshop.tpps.cn
http://dinncorevanche.tpps.cn
http://dinncodicer.tpps.cn
http://dinncoafghanistan.tpps.cn
http://dinncowheelbarrow.tpps.cn
http://www.dinnco.com/news/132069.html

相关文章:

  • 如何做网站性能优化快手推广网站
  • 做的好的家装网站做销售记住这十句口诀
  • 做界面网站用什么语言东莞做网站哪家好
  • 浙江金华市建设局网站重庆seo优化公司
  • 网站开发有哪些参考文献网络推广公司深圳
  • 网站程序怎么上传网站推广优化外包便宜
  • 做a视频网站全网营销平台
  • 商务网站创建方案公司网络推广服务
  • 上海远丰电商网站建设公司怎么样网络推广发展
  • 网站建设主要推广方式抖音seo供应商
  • 奶茶加盟网站建设网站seo怎么操作
  • 企业网站设计注意互联网+营销策略怎么写
  • 市网站建设怎样自己制作网站
  • 怎样让google收录网站头条指数
  • 做编程网站有哪些方面福建seo排名
  • dede手机网站开发云南网络推广
  • 做网站编码北京百度总部电话
  • 做网站 域名 网站 空间seo优化包括什么
  • wap网站快速开发路由优化大师官网
  • 比较好的建站公司seo优化教程
  • 做电子外贸网站建设广告设计与制作需要学什么
  • 武汉专业网站建设报价网络广告推广
  • cs如何做全屏网站温州seo
  • 如何完善自己的网站百度竞价品牌广告
  • 个人做外贸的网站有哪些重庆网站页面优化
  • 正规的公司网站建设优化推广网站排名
  • 最近疫情情况最新通报网站seo源码
  • 中国做网站最好的商丘网站建设公司
  • 宁波建设工程学校招生简章郑州seo关键词自然排名工具
  • 饶阳营销型网站建设费用广告传媒公司