# 11010: 【原1010】二哥的储蓄计划

### 题目描述

author: 刘勤 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1010

## Sample Input

``````290
230
280
200
300
170
340
50
90
80
200
60
``````

## Sample Output

``````-7
``````

## Sample Input

``````290
230
280
200
300
170
330
50
90
80
200
60
``````

## Sample Output

``````1580
``````

## FineArtz's solution

``````/* 二哥的储蓄计划 */
#include <iostream>
using namespace std;

int main(){
int bd = 0, now = 0, mom = 0;
for (int i = 1; i <= 12; ++i){
cin >> bd;
now += 300;
if (now < bd){
cout << '-' << i << endl;
return 0;
}
mom += (now - bd) / 100 * 100;
now = (now - bd) % 100;
}
now += mom * 1.2;
cout << now << endl;
return 0;
}
``````

## ligongzzz's solution

``````#include "iostream"
using namespace std;

int main() {
int data[13] = { 0 };
for (int i = 1; i <= 12; i++)
cin >> data[i];

double bank = 0.0;
int pocket = 0;

//开始循环计算
for (int i = 1; i <= 12; i++) {
//计算存入金额
if (pocket + 300 - data[i] >= 100) {
bank += int((pocket + 300 - data[i]) / 100) * 100;
}
if (pocket + 300 - data[i] < 0) {
cout << "-" << i;
return 0;
}
pocket = (pocket + 300 - data[i]) % 100;
}
cout << int(bank*1.2) + pocket;

return 0;
}
``````

## Neight99's solution

``````#include <iostream>

using namespace std;

int main() {
int money[12] = {0}, cost[12] = {0}, save = 0;
double total;

for (int i = 0; i < 12; i++) {
cin >> cost[i];
}

for (int i = 0; i < 12; i++) {
int save1 = 0;
money[i] += 300;
money[i] -= cost[i];

if (money[i] < 0) {
cout << '-' << i + 1;
return 0;
}

if (i < 11) {
save1 = (money[i] / 100) * 100;
save += save1;
money[i] -= save1;
money[i + 1] += money[i];
}

if (i == 11) {
save1 = (money[i] / 100) * 100;
save += save1;
money[i] -= save1;
}
}

total = save * 1.2 + money[11];
cout << total;
return 0;
}
``````

## skyzh's solution

``````#include <iostream>
using namespace std;

int main() {
int total = 0, saved = 0;
for (int i = 0; i < 12; i++) {
int spend;
cin >> spend;
total = total + 300 - spend;
if (total >= 100) {
saved += int(total / 100) * 100;
total %= 100;
} else if (total < 0) {
cout << - (i + 1) << endl;
return 0;
}
}
cout << int(total + saved * 1.2) << endl;
return 0;
}
``````

## yyong119's solution

``````#include <iostream>
int insufficiency;
int main(){
using namespace std;
insufficiency=0;
for (month=1; month<=12; month++){
rest+=300;
cin>>budget;
rest-=budget;
if (rest>=100){
deposit+=rest-rest%100;
rest=rest%100;
}
if (rest<0){
insufficiency++;