编译不通过,求调
查看原帖
编译不通过,求调
552610
__Shine__楼主2022/7/26 09:31
#include<bits/stdc++.h>
using namespace std;
int n,m,k,r,now_sc,now_tm,cnt;
int a[10001];
struct homework {
	int time;
	int score;
} b[10001];
bool cmp(homework a,homework b) {
	if(a.time==b.time)
		return a.score>b.score;
	else
		return a.time<b.time;
}
int main() {
	cin>>n>>m>>k>>r;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=m; i++)
		cin>>b[i].time;
	for(int i=1; i<=m; i++)
		cin>>b[i].score;
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	for(int i=1; now_sc<k; i++) {
		now_sc+=b[i].score;
		now_tm+=b[i].time; 
	}
	r-=now_tm;
	for(int i=1; r!=0; i++,cnt++)
		r-=a[i];
	cout<<cnt;
	return 0;
}

感觉自己做的不是正解23333

2022/7/26 09:31
加载中...