Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int l,r,a;
  8. cin >> l >> r >> a;
  9.  
  10. int difference = abs(l-r);
  11. int mini = min(l,r);
  12. if(difference>=a)
  13. {
  14.  
  15. cout << (mini+difference)*2 << endl;
  16. }
  17. else
  18. {
  19. //int maxi = max(l,r);
  20. int rest = a-difference;
  21. rest /= 2;
  22. cout << (maxi+rest)*2 << endl;
  23.  
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement