求助,哪里错了?
查看原帖
求助,哪里错了?
65333
Linda_rdfzEDP楼主2020/11/28 09:26
#include <iostream>
#include <cstdio>
using namespace std;
int a[13];
int main() {
	for (int i = 1; i <= 12; i++) {
		cin >> a[i];
	}
	int money[13], sum;
	money[1] = 300 - a[1];
	sum = (money[1] / 100) * 100;
	for (int i = 2; i <= 12; i++) {
		money[i] = (money[i-1] % 100) + 300 - a[i];
		sum += (money[i] / 100) * 100;
		if (money[i] < 0) {
			cout << "-" << i << endl;
			return 0;
		}
	}
	cout << sum*6/5 << endl;
	return 0;
} 
2020/11/28 09:26
加载中...