问一道小模拟
查看原帖
问一道小模拟
804757
Light_Star_RPmax_AFO楼主2023/3/14 21:38

this,样例全对,爆0。

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[10010]={-50},k=0,b[10010]={0};
	cin>>n;
	bool s,g;
	int ans;
	for(int i=0,price,times;i<n;i++,g=0){
		cin>>s>>price>>times;
		if(s==0){
			b[k]=price;
			a[k++]=times;
			ans+=price;
		}
		else {
			for(int i=0;i<k;i++){
				if(times-a[i]<=45&&price<=b[i]){
					a[i]=-50;
					g=1;
					
					break;
				}
			}
			if(!g)ans+=price;
		}
	}
	cout<<ans;
}

太难了,题目总版没人回。

2023/3/14 21:38
加载中...