- C++ 实现
// -*- coding: utf-8 -*-
// @ Date : 2020/5/20 13:14
// @ Author : RichardLau_Cx
// @ file : Richard.cpp
// @ IDE : Dex-C++
// @ Source : luogu
#include <cstdio>
#include <iostream>
using namespace std;
const int alimony = 300; // 妈妈每个月打入的生活费
int main()
{
int jj = 0; // 津津手里的钱
int budget; // 津津的预算
int mum = 0; // 妈妈那里存的钱
// int surplus; // 剩余金额
for (int i=1; i <= 12 ; i++)
{
jj += alimony;
cin >> budget;
jj -= budget;
// cout << "jj: " << jj << endl;
if (jj >= 100)
{
int remainder; // 剩余几百
remainder = jj / 100;
// 整百存入妈妈那里
mum += remainder * 100;
jj -= remainder * 100;
// cout << "remainder: " << remainder << endl;
}
else if (jj < 0)
{
cout << "-" << i << endl;
break;
}
if (i == 12)
{
jj = jj + mum / 10 * (10 + 2);
cout << jj;
}
}
return 0;
}