fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. int main() {
  5. int a, b, c;
  6. std::cin >> a >> b >> c;
  7.  
  8. int arr[3] = {a, b, c};
  9. std::sort(arr, arr + 3);
  10.  
  11. int trepte_libere = (arr[1] - arr[0] - 1) + (arr[2] - arr[1] - 1);
  12.  
  13. std::cout << trepte_libere << std::endl;
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5316KB
stdin
10 10  11
stdout
-1