第五个有问题 其他的没问题 有没有大佬帮帮 求求了 5555
#include <iostream>
#include <cmath>
using namespace std;
class student {
public:
int chinese;
int math;
int english;
student() {
chinese = 0;
math = 0;
english = 0;
}
student(int a, int b, int c) {
chinese = a;
math = b;
english = c;
}
void setstudent(int a, int b, int c) {
chinese = a;
math = b;
english = c;
}
int sum() {
return ((this->chinese) + (this->english) + (this->math));
}
};
int main()
{
int i;
cin >> i;
student* newstudent = new student();
student studentlist[999] = {};
for (int a = 0; a < i; a++) {
int chinese,math,english;
cin >> chinese;
cin >> math;
cin >> english;
studentlist[a].setstudent(chinese, math, english);
}
int count = 0;
for (int a = 0; a < i-1 ; a++) {
for (int b =a+1; b < i; b++) {
bool turn = true;
//cout << a<<endl;
//cout << b << endl;
//cout << studentlist[a].chinese << endl;
//cout << studentlist[a].math << endl;
//cout << studentlist[a].english << endl;
//cout << studentlist[b].chinese << endl;
//cout << studentlist[b].math << endl;
//cout << studentlist[b].english << endl;
if (abs(studentlist[a].chinese - studentlist[b].chinese) > 5) {
turn = false;
}
if (abs(studentlist[a].math - studentlist[b].math) > 5) {
turn = false;
}
if (abs(studentlist[a].english - studentlist[b].english) > 5) {
turn = false;
}
if (abs(studentlist[a].sum() - studentlist[b].sum()) > 10) {
turn = false;
}
if (turn) {
count++;
}
}
}
cout << count;
}