Codeforces 1272A. Three Friends Solution

  1. Solve in C++:
  2. ///**********ALLAH IS ALMIGHTY************///
  3. ///AH Tonmoy
  4. ///Department of CSE,23rd batch
  5. ///Islamic University,Bangladesh
  6. #include<bits/stdc++.h>
  7. using namespace std;
  8. int main()
  9. {
  10. int a,b,c,t;
  11. cin>>t;
  12. while(t--)
  13. {
  14. cin>>a>>b>>c;
  15. cout<<max((abs(a-b)+abs(a-c)+abs(b-c))-4,0)<<endl;
  16. }
  17. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.