【2019校招真题】解码方法(python)

解码方法_牛客网

https://www.nowcoder.com/practice/b83b126603dd4e63bc4287d32d754886?tpId=98&tqId=32868&tPage=3&rp=3&ru=/ta/2019test&qru=/ta/2019test/question-ranking

完整代码

s = input()

n = len(s)
x_1 = 1
for i in range(n):
  if i == 0:
    x_2 = 1
  else:
    if int(s[i - 1: i + 1]) <= 26:
      x_1, x_2 = x_2, x_1 + x_2
    else:
      x_1 = x_2
print(x_2)

全部评论

相关推荐

买蜜雪也用卷:我觉得应该没有哪个人敢说自己熟练使用git,代码分支一复杂还是得慢慢寻思一下的,不过基本的拉代码提交代码还有分支什么的是应该会
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务