# 1835：【04NOIP提高组】津津的储蓄计划(1835: [04noip improvement group] Jinjin savings plan)-其他

## 1835：【04NOIP提高组】津津的储蓄计划(1835: [04noip improvement group] Jinjin savings plan)

### 【输入】

12行数据，每行包含一个小于350的非负整数，分别表示1月到12月津津的预算。

### 【输入样例】

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

### 【输出样例】

``-7``

### 【提示】

【样例输入2】

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

【样例输出2】

``1580``

#include<iostream>#include<cstdio>int main(){ int b,sum=0; for(int i=1;i<=12;i++) { int a; scanf(“%d”,&a); sum+=300; if(sum>=a) { b+=(sum-a)%1000-(sum-a)%100; sum-=(sum-a)%1000-(sum-a)%100+a; } else { printf(“%d”,i); return 0; } } double a=sum+b*(1.2*1.0); printf(“%d”,(int)a); return 0;}

————————

### [Title Description]

The pocket money of Jinjin has always been managed by itself. At the beginning of each month, my mother gives 300 yuan to Jinjin. Jinjin will budget the expenses of this month, and always make the actual expenses the same as the budget.

In order to let Jinjin learn how to save, her mother proposed that Jinjin could deposit 100% of her money at any time, and she would return it to Jinjin with 20% at the end of the year. Therefore, Jinjin has formulated a savings plan: at the beginning of each month, after receiving the pocket money given by her mother, if she expects to have more than 100 yuan or exactly 100 yuan in her hand by the end of this month, she will deposit the whole 100 yuan with her mother and leave the rest in her own hands.

For example, in early November, there was 83 yuan in Jinjin’s hand, and her mother gave 300 yuan to Jinjin. Jinjin is expected to spend 180 yuan in November, so she will save 200 yuan from her mother and leave 183 yuan by herself. By the end of November, Jinjin will have 3 yuan left.

Jinjin found that the main risk of the savings plan was that the money stored in her mother could not be withdrawn before the end of the year. It is possible that at the beginning of a month, the money in Jinjin’s hands plus the money given by his mother this month is not enough for the original budget of this month. If this happens, Tianjin will have to live frugally and reduce its budget this month.

Now please judge whether this will happen according to the monthly budget of Tianjin from January to December 2004. If not, by the end of 2004, how much money will there be in Jinjin’s hands after my mother returns the money normally saved in Jinjin plus 20%.

### [input]

12 lines of data, each line contains a non negative integer less than 350, representing the budget of Tianjin from January to December respectively.

### [output]

A line that contains only one integer. If there is insufficient money in a certain month during the implementation of the savings plan, output – x, and X represents the first month of this situation; Otherwise, how much money will there be in Jinjin’s hands by the end of 2004.

### [input example]

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

### [output example]

``-7``

### [tips]

[example input 2]

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

[sample output 2]

``1580``

#include<iostream>#include<cstdio>int main(){ int b,sum=0; for(int i=1;i<=12;i++) { int a; scanf(“%d”,&a); sum+=300; if(sum>=a) { b+=(sum-a)%1000-(sum-a)%100; sum-=(sum-a)%1000-(sum-a)%100+a; } else { printf(“%d”,i); return 0; } } double a=sum+b*(1.2*1.0); printf(“%d”,(int)a); return 0;}