60分 退出代码255求助
查看原帖
60分 退出代码255求助
825633
kzhhhhh楼主2022/10/21 12:52
#include<iostream>
#include<vector>
using  std::vector;
using namespace std;

int main() {
   
    int budget, num, left;
    int account = 0;
    int month = 1;
    int cash = 0;
    vector <int> v;
    while (cin >> budget) {
        v.push_back(budget);
    }
    for (month = 1; month <= 12; ++month) {
        cash = cash + 300;
        if (cash >= v[month - 1]) {
            left = cash - v[month - 1];
            num = left / 100;
            account += num * 100;
            cash = left - num * 100;
        }
    else {
            cout << '-' << month;
            return -1;

        }

    }
    cout << account * 1.2 + cash;


    return 0;
}
2022/10/21 12:52
加载中...