洛谷-P1089 津津的储蓄计划

# -*- coding: utf-8 -*-
"""
Created on Tue Apr 10 23:10:48 2018


@author: wdf
"""


m = 300# //每月的收入 
flag = True#判断是否超支 
h = 0
s = 0


for i in range(1,13):
    a = int(input())#输入 
    h += m#领工资 
    if (h < a): #超支直接结束程序 
        print -i
        flag = False
        break
    left = h - a#存钱前本月余钱 
    h = left % 100#存钱后本月余钱 
    s += left - h#增加存款 


if (flag):
    print(int( s * 1.2 + h))

你可能感兴趣的:(洛谷-python)