编程语言
首页 > 编程语言> > 1071 小赌怡情 (15 分) python

1071 小赌怡情 (15 分) python

作者:互联网

1071 小赌怡情 (15 分)

money, n = map(int, input().split())
for _ in range(n):
    #money为0的判断放在输入前,否则测试点4不过,应考虑玩家一开始的筹码为0的情况
    if money == 0:
        print('Game Over.')
        break
    info = list(map(int, input().split()))
#     if money == 0:    #错误写法
#         print('Game Over.')
#         break
    if info[2] > money:
        print('Not enough tokens.  Total = ' + str(money) + '.')
    elif (info[0] < info[-1] and info[1] == 1) or (info[0] > info[-1] and info[1] == 0):
        money += info[2]
        print("Win "+ str(info[2]) + '!  Total = ' + str(money) + '.')
    else:
        money -= info[2]
        print("Lose " + str(info[2]) + ".  Total = " + str(money) + '.')

    

标签:info,小赌,15,python,money,int,str,print,Total
来源: https://blog.csdn.net/jinyun15638606903/article/details/121024261