就对了1、6、8测试点,求大佬指错
#include<bits/stdc++.h>
using namespace std;
int main (){
int x = 0,y,a,b,q,ans = 0;
for(int i = 1;i <= 12;i++){
cin >> y;
if(y > 300){
if(x < y-300){
cout << -i;
return 0;
}else{
q = y-300;
x = x - q;
}
}else{
a = 300 - y;
if(a > 100||a == 100){
b = a % 100;
a = a-b;
ans = a / 100;//1
b=ans * 100;
x = 300 - b - y;
}else{
x += a;
}//100
}
}
x += ans*120;
cout << x;
return 0;
}