fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #define MAX(A,B) ((A)>(B)?(A):(B))
  6.  
  7. int main() {
  8. int a,b,c;
  9. cin >>a>>b>>c;
  10. int max = MAX(a,MAX(b,c));
  11. cout << (max < a+b+c-max ? a+b+c : 2*(a+b+c-max)-1);
  12. }
Success #stdin #stdout 0.01s 5284KB
stdin
3 2 1
stdout
5