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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.