fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int a, b, c, d;
  8.  
  9. cin >> a >> b >> c >> d;
  10.  
  11. int res = a + b + c + d - min({a, b, c, d}) + 1;
  12.  
  13. cout << res << "\n";
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5284KB
stdin
14 9 4 7
stdout
31