当前位置 :
【ACM一道题关于字母对应数字的情况数的DescriptionAliceandBobneedtosendsecretmessagestoeachotherandarediscussingwaystoencodetheirmessages:Alice:"Let'sjustuseaverysimplecode:We'llassign`A'thecodeword1,`B'will】
1人问答
问题描述:

ACM一道题关于字母对应数字的情况数的

Description

AliceandBobneedtosendsecretmessagestoeachotherandarediscussingwaystoencodetheirmessages:Alice:"Let'sjustuseaverysimplecode:We'llassign`A'thecodeword1,`B'willbe2,andsoondownto`Z'beingassigned26."Bob:"That'sastupidcode,Alice.SupposeIsendyoutheword`BEAN'encodedas25114.Youcoulddecodethatinmanydifferentways!"Alice:"Sureyoucould,butwhatwordswouldyouget?Otherthan`BEAN',you'dget`BEAAD',`YAAD',`YAN',`YKD'and`BEKD'.Ithinkyouwouldbeabletofigureoutthecorrectdecoding.Andwhywouldyousendmetheword`BEAN'anyway?"Bob:"OK,maybethat'sabadexample,butIbetyouthatifyougotastringoflength500therewouldbetonsofdifferentdecodingsandwiththatmanyyouwouldfindatleasttwodifferentonesthatwouldmakesense."Alice:"Howmanydifferentdecodings?"Bob:"Jillions!"Forsomereason,AliceisstillunconvincedbyBob'sargument,sosherequiresaprogramthatwilldeterminehowmanydecodingstherecanbeforagivenstringusinghercode.

Input

Inputwillconsistofmultipleinputsets.Eachsetwillconsistofasinglelineofdigitsrepresentingavalidencryption(forexample,nolinewillbeginwitha0).Therewillbenospacesbetweenthedigits.Aninputlineof`0'willterminatetheinputandshouldnotbeprocessed

Output

ForeachinputSampleInput

Copytoclipboard

25114

1111111111

3333333333

SampleOutput

6

89

1

能否提供更多的测试用例给我?

更多的测试用例,

刘跃虎回答:
  222222222->5522222222->342222222->21222222->1322222->82222->5222->322->2123123123123->8112312312312->541231231231->27123123123->2712312312->181231231->9123123->912312->61231->3123->312->2
最新更新
PC端 | 移动端 | mip端
字典翻译(zidianfy.com)汇总了汉语字典,新华字典,成语字典,组词,词语,在线查字典,中文字典,英汉字典,在线字典,康熙字典等等,是学生查询学习资料的好帮手,是老师教学的好助手。
声明:本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
电话:  邮箱:
Copyright©2009-2021 字典翻译 zidianfy.com 版权所有 闽ICP备2022014709号-7
lyric 頭條新聞