You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
468 B

#include <bits/stdc++.h>
using namespace std;
int month, Left, save, plan;
int main() {
for (month = 1; month <= 12; month++) {
Left += 300;
cin >> plan;
Left = Left - plan;
if (Left < 0) {
printf("-%d", month);
exit(0);
}
int cnt = Left / 100;
save += (100 * cnt);
Left -= (100 * cnt);
}
printf("%d", (int)(1.2 * save) + Left);
return 0;
}