欢迎光临散文网 会员登陆 & 注册

1074:津津的储蓄计划-信息学奥赛一本通

2023-07-23 09:54 作者:机房吃鸡  | 我要投稿

#include<algorithm>

#include<cmath>

#include<cstdio>

#include<iostream>



using namespace std;


int main(){

const double credit=300;//妈妈每个月发的零用钱

double cash=0;//津津手里的现金 

double deposit;//津津存在妈妈那里的钱,只能是整百

for(int X=1;X<=12;X++){

double budget;//预算

cin>>budget;

cash+=credit;//300零用钱入账 

cash-=budget;//现金-预算 

if(cash<0){

cout<<-X;

return 0;//直接输出并结束程序 

}

if(cash>=100){

int hundred=(int)cash/100*100;

deposit+=hundred;

cash-=hundred;

}

printf("%.0lf",deposit*1.2+cash);


return 0;

}


1074:津津的储蓄计划-信息学奥赛一本通的评论 (共 条)

分享到微博请遵守国家法律