样例都过不了,求助!
查看原帖
样例都过不了,求助!
922691
Hisy楼主2023/8/17 17:16
#include<algorithm>
#include<iostream>
using namespace std;
bool compare(int cmp1,int cmp2){
	return cmp1>cmp2;
};
void sorting(int *first,int *last){
	sort(first,last,compare);
};
void inputer(int *team,int maxn){
	for(int it=1;it<=maxn;++it){
		cin>>team[it];
	};
};
int main(int argc,char **argv){
	int maxn1,maxn2,maxn3,maxn4;
	cin>>maxn1>>maxn2>>maxn3>>maxn4;
	int *team1=new int[maxn1+1];
	int *team2=new int[maxn2+1];
	int *team3=new int[maxn3+1];
	int *team4=new int[maxn4+1];
	inputer(team1,maxn1);
	inputer(team2,maxn2);
	inputer(team3,maxn3);
	inputer(team4,maxn4);
	sorting(team1+1,team1+maxn1);
	sorting(team2+1,team2+maxn2);
	sorting(team3+1,team3+maxn3);
	sorting(team4+1,team4+maxn4);
	int maxn,mem1,mem2,mem3;
	int count1=0,count2=1,count3=1,count4=1;
	cin>>maxn;
	while(maxn--){
		cin>>mem1>>mem2>>mem3;
		float answer=0;
		answer+=team1[++count1];
		for(int it=count2;it<=count2+mem1-1;++it){
			answer+=team2[it];
		};
		count2+=mem1;
		for(int it=count3;it<=count3+mem2-1;++it){
			answer+=team3[it];
		};
		count3+=mem2;
		for(int it=count4;it<=count4+mem3-1;++it){
			answer+=team4[it];
		};
		count4+=mem3;
		printf("%.2f\n",answer/11);
	};
	return 0;
};
2023/8/17 17:16
加载中...