1074 津津的储蓄计划

include<iostream>
using namespace std;
int main(){
    int n=0,x,s=0,a,b=0,y=1;
    for(int i=1;i<=12;i++){    
        cin>>x;
        n=n+300-x;
        if(n>=0){        
            s+=n/100*100;
            n%=100;
        }
        else if(y){
                b=i;
                y=0;
        }    
    }
    a=s*1.2+n;
    if(y){
    
        cout<<a;    
    }else{
        cout<<-b;
    }
    return 0;
}

 

posted @ 2023-03-25 19:17  郭立恒  阅读(37)  评论(0)    收藏  举报