@[jzy2011](/user/1034698)
1.将`money`和`mommoney`改为`int`类型
2.将13~15行改为
```cpp
money-=a[i];
if(money<100)continue;
int x=(money)/100*100;
```
by __wangboyue__ @ 2023-12-24 14:15:41
@[__wangboyue__](/user/740325)
thanks
by jzy2011 @ 2023-12-24 14:21:55
@[__wangboyue__](/user/740325)
但是这样只有20分欸
by jzy2011 @ 2023-12-24 14:40:11
```c
#include<iostream>
using namespace std;
int a[13],s=0,i,c=0;
int main(){
for(i=1;i<=12;i++)cin>>a[i];
for(i=1;i<=12;i++){
s+=300;
s-=a[i];
if(s<0){
cout<<"-"<<i;
return 0;
}
else{
while(s>=100){
s-=100;
c+=100;
}
}
}
cout<<s+c*12/10;
}
```
可以這樣
by IMPOSTORrrrrrr @ 2023-12-24 18:39:08
@[jzy2011](/user/1034698)
```cpp
#include<bits/stdc++.h>
using namespace std;
signed main(){
int a[100]={};
int money=0,mommoney=0;
for(int i=0;i<12;i++){
cin>>a[i];
money+=300;
if(money<a[i]){
cout<<-(i+1);
return 0;
}
money-=a[i];
if(money<100)continue;
int x=(money)/100*100;
money-=x;
mommoney+=x;
}
cout<<money+mommoney*1.2;
return 0;
}
```
注意不要替换掉`money-=x;`
by __wangboyue__ @ 2023-12-25 13:11:02