1 条题解
-
0
#include <iostream> #include <string.h> #include <cstdio> #include <algorithm> #include <string> #include <iomanip> #include <math.h> #include <map> #include <set> #include <queue> #include <stack> #include <vector> #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; using namespace std; int a[7], n, Max, secondMax, max1, max2; int main() { cin >> n; while(n--) { // 最大值 第二大值 前两个人的较大值 后两个人的较大值 // 因为求的是较大值, 所以初始化成0 Max = secondMax = max1 = max2 = 0; cin >> a[1] >> a[2] >> a[3] >> a[4]; for(int i = 1; i <= 4; i++) { if(a[i] > Max)// 找到一个比最大值还要大的值 { secondMax = Max;// 以前的最大变成了第二大 Max = a[i];// 重新赋值最大值 } else if(a[i] > secondMax)// 比第二大的值更大 { secondMax = a[i];// 更新第二大的值 } } max1 = max(a[1], a[2]); max2 = max(a[3], a[4]); // 前两个人的较大值和后两个人的较大值分别和最大以及第二大相等,或者反过来相等 if(max1 == Max and max2 == secondMax or max1 == secondMax and max2 == Max) { cout << "YES\n"; } else { cout << "NO\n"; } } return 0; }
- 1
信息
- ID
- 2347
- 时间
- 2000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 94
- 已通过
- 36
- 上传者