Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define eps 1e-9
- #define eq(a, b) (abs(a-b) < eps)
- double v[4], acc, sum;
- int main() {
- for (int i : {0, 1, 2, 3}) {
- cin >> v[i];
- acc += v[i];
- }
- do {
- sum = 0;
- for (int i : {0, 1, 2, 3}) {
- sum += v[i];
- if (eq(acc - sum, sum)) {
- cout << "YES\n";
- return 0;
- }
- }
- } while (next_permutation(v, v+4)) ;
- cout << "NO\n";
- return 0;
- }
Add Comment
Please, Sign In to add comment