题解 | #将真分数分解为埃及分数#

将真分数分解为埃及分数

https://www.nowcoder.com/practice/e0480b2c6aa24bfba0935ffcca3ccb7b

while True:
    try:
        string = input().split("/")
        res = []
        son = int(string[0])
        mom = string[1]
        while son >= 1:
            res.append("1/" + mom)
            son -= 1
        print('+'.join(map(str,res)))
    except:
        break

全部评论

相关推荐

牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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