Codeforces Educational Round#98 A
A
思路:
考慮三種可能:要不要換,換1,換0
程式碼:
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
typedef long long LL;
int test=1;
int main()
{
scanf("%d",&test);
while(test--)
{
int x,y;
cin >> x >> y;
if(abs(x-y)<=1)
{
cout << x + y << '\n';
continue;
}
cout << x + y + abs(x-y)-1 << '\n';
}
return 0;
}
相關文章
- Educational Codeforces Round 32
- Educational Codeforces Round 1 Tutorial
- Educational Codeforces Round 163
- 【題解】Educational Codeforces Round 82
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
- Educational Codeforces Round 171 (Div. 2)
- Educational Codeforces Round 37 (Rated for Div. 2)
- Educational Codeforces Round 93 (Rated for Div. 2)
- Educational Codeforces Round 96 A-E 題解
- Educational Codeforces Round 170 (Rated for Div. 2)
- Educational Codeforces Round 171 div2(A~E)
- Educational Codeforces Round 19 E. Array Queries
- Educational Codeforces Round 100-C. Busy Robot
- Educational Codeforces Round 100 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 163 (Rated for Div. 2)
- Educational Codeforces Round 154 (Rated for Div. 2)
- Educational Codeforces Round 168 (Rated for Div. 2)
- Educational Codeforces Round 166 個人題解(A~D)
- Educational Codeforces Round 166(A-D題解)
- 【CodeForces訓練記錄】Educational Codeforces Round 171 (Rated for Div. 2)
- Educational Codeforces Round 93 (Rated for Div. 2)題解
- Educational Codeforces Round 170 (Rated for Div. 2) A-D
- Educational Codeforces Round 170 (Rated for Div. 2) ABCD
- Educational Codeforces Round 171 (Rated for Div. 2) 題解
- Educational Codeforces Round 168 (Rated for Div. 2) A - E
- Educational Codeforces Round 143 (Rated for Div. 2) A-E
- Educational Codeforces Round 142 (Rated for Div. 2) A-D
- vp Educational Codeforces Round 168 (Rated for Div. 2) A - E
- Educational Codeforces Round 168 (Rated for Div. 2) 題解
- Educational Codeforces Round 4 D The Union of k-Segments (掃描線)
- Educational Codeforces Round 95 (Rated for Div. 2) G. Three Occurrences
- Educational Codeforces Round 163 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 166 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 162 (Rated for Div. 2) - VP記錄
- Educational Codeforces Round 159 (Rated for Div. 2) - VP記錄