2 solutions
-
0
#include #include #include using namespace std; struct stu { string name; int chinese, math, english, total; } a[1001]; bool qwq(stu a, stu b) { if ( abs(a.chinese - b.chinese) <= 5 && abs(a.math - b.math) <= 5 && abs(a.english - b.english) <= 5 && abs(a.total - b.total) <= 10 ) return 1; else return 0; } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].name >> a[i].chinese >> a[i].math >> a[i].english; a[i].total = a[i].chinese + a[i].math + a[i].english; } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (qwq(a[i], a[j])) cout << a[i].name << " " << a[j].name << endl; } } return 0; }
Information
- ID
- 1615
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 7
- Accepted
- 4
- Uploaded By