A - Equally 解説 by en_translator
If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).
This problem can be solved with case analysis.
The numbers can be divided into three groups with equal sums if and only if \(A=B=C\).
When can the numbers be divided into two groups with equal sums? There are three ways to divide them into two groups; the condition is met if and only if at least one of \(A+B=C,B+C=A\), or \(C+A=B\) is satisfied.
If any of them are satisfied, the answer is Yes
; otherwise, the answer is No
.
A, B, C = map(int, input().split())
if A == B == C or A + B == C or B + C == A or C + A == B:
print("Yes")
else:
print("No")
#include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
if ((A == B && B == C) || A + B == C || B + C == A || C + A == B) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
投稿日時:
最終更新: