Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int l,r,a;
- cin >> l >> r >> a;
- int difference = abs(l-r);
- int mini = min(l,r);
- if(difference>=a)
- {
- cout << (mini+difference)*2 << endl;
- }
- else
- {
- //int maxi = max(l,r);
- int rest = a-difference;
- rest /= 2;
- cout << (maxi+rest)*2 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement