P1089_数组计数

#include<iostream>
using namespace std;
int main() {
	int M[12];//12个月的预算
    int RESIDUE=0;//每月初的money
    int PINMONEY = 0;//每月末的money
    int DEPOSIT = 0;//存款
	for (int i = 0; i < 12; i++)cin >>M[i];
	for (int i = 0; i < 12; i++) {
		RESIDUE = PINMONEY + 300 - M[i];//
		if (RESIDUE >= 0) {//存款
			DEPOSIT += ((RESIDUE / 100)*100);
			PINMONEY = (RESIDUE % 100);
		}
		else {
			cout << -(i + 1); 
			break;
		}
		if (i == 11)cout << DEPOSIT * 1.2+PINMONEY;
	}
	return 0;
}