40分,找不到样例二错的原因,求大佬解答
查看原帖
40分,找不到样例二错的原因,求大佬解答
1159068
wsy070930楼主2023/11/14 00:25
#include<bits/stdc++.h>
using namespace std;
int main(){
	int store=0,hand=0;
	for(int i=1;i<=12;i++){
		int cost;
		cin>>cost;
		int x=(300+hand-cost)/100*100;
		if(300+hand-cost>=100){
			store+=x;
			hand+=300-cost-x;
		}
		else if(300+hand-cost>=0&&300+hand-cost<100) hand+=300-cost-x;
		else{
			cout<<-i;
			return 0;
		}
	}
	cout<<store*1.2;
}
2023/11/14 00:25
加载中...