python3
查看原帖
python3
245125
grey_qisen楼主2021/8/16 17:25

测试点2输出1946.0 接收1946,难道是因为这个么?

def P_1089():
    """
    https://www.luogu.com.cn/problem/P1089
    Returns:

    """
    cost_list = []
    for month in range(12):
        cost_list.append(int(input().strip()))
    left_money = 0
    mom_money = 0
    for pos, cost in enumerate(cost_list):
        left_money = left_money + 300 - cost
        if left_money < 0:
            print(-(pos + 1))
            return
        else:
            mom_money += int(left_money / 100) * 100
            left_money = left_money % 100
    print(mom_money * 1.2 + left_money)
    
P_1089()
2021/8/16 17:25
加载中...