fork download
  1. #include<iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int main (){
  5. long long a,b,c,d;
  6. cin >> a>>b>>c>>d;
  7.  
  8.  
  9. if (a + b + c == d ||
  10. a + b - c == d ||
  11. a - b + c == d ||
  12. a - b - c == d ||
  13. a * b + c == d ||
  14. a * b - c == d ||
  15. a + b * c == d ||
  16. a - b * c == d ||
  17. a * b * c == d) {
  18. cout << "YES" << endl;
  19. } else {
  20. cout << "NO" << endl;
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
NO