【NOIP2004】【Luogu1089】津津的储蓄计划

problem

tan90

solution

tan90

codes

#include<iostream>
using namespace std;
int main(){
    int flag = 0, t = 0, res = 0;
    for(int i = 0; i < 12; i++){
        int x;  cin>>x; 
        t += 300-x;
        if(t < 0){ flag = (i+1)*-1; break;}
        else{
            res += t/100;
            t %= 100;
        }
    }
    if(!flag)cout<<t+res*120;
    else cout<<flag;
    return 0;
}
posted @ 2018-05-22 12:54  gwj1139177410  阅读(151)  评论(0编辑  收藏  举报
选择