紧急求援
查看原帖
紧急求援
349592
轮回·天照楼主2020/11/30 20:26

全是WA,不知道为什么

#include <bits/stdc++.h>
using namespace std;
struct stu{
	char name[8];
	int chinese;
	int maths;
	int english;
}arr[1001];
int main(){
	int n;
	cin >> n;
	for(int i = 0;i < n;i++)
		cin >> arr[i].name >> arr[i].chinese >> arr[i].maths >> arr[i].english;
	for(int i = 0;i < n;i++){
		for(int j = i + 1;j < n;j++){
			int chi = arr[i].chinese - arr[j].chinese;
			int mat = arr[i].maths - arr[j].maths;
			int eng = arr[i].english - arr[j].english;
			if(abs(chi) <= 5 && abs(mat) <= 5 && abs(eng) <= 5 && abs(chi+mat+eng) <= 10)
				cout << arr[i].name << ' ' << arr[j].name << endl;
		}
	}
	return 0;
}
2020/11/30 20:26
加载中...