Official
A - Median? Editorial by KoD
\(a, b, c\) を小さい順に並べた時に \(b\) が \(2\) 番目に来るかどうか調べればよいです。
\(a \leq b \leq c\) または \(a \geq b \geq c\) ならば Yes
、そうでないならば No
が答えです。
実装例 (C++) :
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if ((a <= b and b <= c) or (a >= b and b >= c)) {
cout << "Yes\n";
} else {
cout << "No\n";
}
return 0;
}
実装例 (Python) :
a, b, c = map(int, input().split())
print("Yes" if a <= b <= c or a >= b >= c else "No")
posted:
last update: