全WA,求帮助
查看原帖
全WA,求帮助
361339
kongyuner楼主2020/8/29 13:51
#include <bits/stdc++.h>
using namespace std;
struct student {
	int yu,shu,ying,zong;
	string s;
};

int main (){
	int n;
	student stu[1001];
	cin >> n;
	for(int i = 0;i<n;i++){
		cin >> s >> stu[i].yu>>stu[i].shu>>stu[i].ying ; 
		stu[i].zong = stu[i].yu + stu[i].shu + stu[i].ying;
	}
	for(int i = 0;i<n;i++){
		for(int j = i+1;j<n;j++){
			int yu_tmp=stu[i].yu-stu[j].yu;
			int shu_tmp=stu[i].shu-stu[j].shu;
			int ying_tmp=stu[i].ying-stu[j].ying;
			int zong_tmp=stu[i].zong-stu[j].zong;
		if(yu_tmp<=5&&shu_tmp<=5&&ying_tmp<=5&&zong_tmp<=10){
			if(stu[i].s<stu[j].s ){
				cout << stu[i].s << stu[j].s << endl; 
			}else{
				cout << stu[j].s << stu[i].s << endl;
			}
		}
	}		
	}
	return 0;
}
2020/8/29 13:51
加载中...