Python P1089 津津的储蓄计划

https://www.luogu.org/problemnew/show/P1089

k = -1
sum, last = 0,0
for i in range(12):
    a = int(input())
    if(last + 300 < a) :
        k = i + 1
        break
    last = last + 300 - a
    sum += last//100
    last %= 100
if(k > 0):
    print(-k)
else:
    sum *= 100
    sum = sum + sum*0.2
    sum += last
    print(int(sum))

 

你可能感兴趣的:(Python,洛谷)