#include<stdio.h>
int main() {
int plan, overplus = 0, flag = 1, month;
int m, total = 0;
for (int i = 1; i <= 12; i++) {
scanf("%d", &plan);//输入每月计划
overplus = overplus + 300 - plan;
if (overplus < 0 && flag) {
flag = 0;
month = i;
}//当月余钱为负时,赋flag值为0;反之不变;
m = overplus / 100;//计算每月存入多少钱;
overplus = overplus - m * 100;
total += m * 100;
}
if (flag == 0)printf("%d", -1 * month);
else {
printf("%.0f", total * 1.2 + overplus);
}
return 0;
错题集(1) 津津的储蓄计划
于 2023-07-17 20:50:15 首次发布