嗯枚举就可以了喵~
#include <algorithm>
#include <array>
#include <iostream>
using namespace std;
int a[6];
bool Check(int x, int y, int z) {
array<int, 3> t;
t[0] = a[x];
t[1] = a[y];
t[2] = a[z];
sort(t.begin(), t.end());
return t[0] + t[1] > t[2];
}
void Solve() {
for (int i = 0; i < 6; i++) {
cin >> a[i];
}
for (int i = 0; i < 4; i++) {
for (int j = i + 1; j < 5; j++) {
for (int k = j + 1; k < 6; k++) {
if (Check(i, j, k)) {
int x = 0;
while (x == i || x == j || x == k) {
x++;
}
int y = x;
x++;
while (x == i || x == j || x == k) {
x++;
}
int z = x;
x++;
while (x == i || x == j || x == k) {
x++;
}
if (Check(x, y, z)) {
cout << "Yes\n";
return;
}
}
}
}
}
cout << "No\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
Solve();
}
}
// 64 位输出请用 printf("%lld")

京公网安备 11010502036488号