题解 | 变幻莫测

变幻莫测

https://www.nowcoder.com/practice/5e702b6c7c114e64b5db4650d0ce0051

x, y = map(int, input().split())
c = 0
while x != y:
    if c < 100:
        if x != 0:
            x, y = x + y,x - y
        else:
            x, y = y, x
        c += 1
    else:
        break
if x == y:
    print(c)
else:
    print(-1)

全部评论

相关推荐

Edgestr:没项目地址就干脆把那一栏删了呗
点赞 评论 收藏
分享
01-27 15:41
门头沟学院 Java
想躺平的菜鸡1枚:我项目比你难、学历比你好、还有SCI论文,投java都被拒一大片,现在基本上都要问点agent开发
软件开发投递记录
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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