ABC 124 Editorial¶
Problem A: Buttons¶
The idea of this problem is to chose the maximum button during the first button press. During the second button press, we will chose the maximum after subtracting 1 from the button we just pressed. The code bellow simulates this process:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <bits/stdc++.h>
using namespace std;
int main () {
int a, b;
cin >> a >> b;
if ( a > b) {
cout << max(a,b) + max(a-1,b);
} else {
cout << max(a,b) + max(a,b-1);
}
return 0;
}
|