题解 | #大吉大利,今晚吃鸡#

大吉大利,今晚吃鸡

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

def min_steps(n):
    if n == 0:
        return 0
    else:
        # Recursive formula to calculate steps
        return 3 * min_steps(n - 1) + 2

def main():
    import sys
    input = sys.stdin.read
    data = input().strip().split()
    
    for line in data:
        if line.strip():
            n = int(line)
            print(min_steps(n))

if __name__ == "__main__":
    main()

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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