ProgMe

Untitled

Mar 30th, 2020
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define e endl
  4. #define r0 return 0
  5. #define co continue
  6.  
  7. using namespace std;
  8.  
  9. int f ( ll aa , ll bb , ll cc ) {
  10. vector <ll> arr;
  11. arr.push_back(aa);
  12. arr.push_back(bb);
  13. arr.push_back(cc);
  14. sort ( arr.begin() , arr.end() );
  15. if ( arr[2] - arr[0] == 0 || arr[2] - arr[0] == 1 || arr[2] - arr[0] == 2 ) {
  16. return 0 ;
  17. }
  18. else {
  19. //if ( arr[1] == arr[2] ) {
  20. // arr[1] -- ;
  21. // arr[2] -- ;
  22. // arr[0] ++ ;
  23. arr[2] -- ;
  24. arr[1] -- ;
  25. arr[0] ++ ;
  26. return ( arr[2] - arr[0] ) + ( arr[1] - arr[0] ) + ( arr[2] - arr[1]);
  27. //}
  28. //else {
  29. // arr[]
  30. //}
  31. }
  32. }
  33.  
  34. int main()
  35. {
  36. ios_base::sync_with_stdio(false);
  37. cin.tie(0);
  38. cout.tie(0);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. int t ;
  48. cin >> t ;
  49. while ( t -- ) {
  50. ll a , b , c ;
  51. cin >> a >> b >> c ;
  52. cout << f ( a , b , c ) << e ;
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment