P10839 【MX-J2-T0】Turtle and Equations 题解
Little_x_starTYJ · · 题解
解题思路
一共有
我们进行分类讨论。
如果以上情况等式都不成立,我们打印 No。
CODE:
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int a, b, c, d;
cin >> a >> b >> c >> d;
if ((a + b) + c == d || (a - b) + c == d || a * b + c == d
|| (a + b) - c == d || (a - b) - c == d || a * b - c == d
|| (a + b) * c == d || (a - b) * c == d || a * b * c == d) {
cout << "Yes";
} else
cout << "No";
return 0;
}