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 37 (Rated for Div. 2)
- Educational Codeforces Round 93 (Rated for Div. 2)
- Educational Codeforces Round 96 A-E 題解
- 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題解)
- Educational Codeforces Round 93 (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
- Educational Codeforces Round 168 (Rated for Div. 2) 題解
- Educational Codeforces Round 4 D The Union of k-Segments (掃描線)
- Educational Codeforces Round 99 (Rated for Div. 2)D. Sequence and Swaps
- Educational Codeforces Round 163 (Rated for Div. 2) 補題記錄(A~A)
- Educational Codeforces Round 167 (Rated for Div. 2) D(dp,貪心)
- Educational Codeforces Round 98 (Rated for Div. 2) E. Two Editorials 細節題
- Educational Codeforces Round 99 (Rated for Div. 2) D. Sequence and Swaps(貪心)
- [CF1954] Educational Codeforces Round 164 (Rated for Div. 2) 題解
- Educational Codeforces Round 165 (Rated for Div. 2) C. Minimizing the Sum題解
- Educational Codeforces Round 166 (Rated for Div. 2) (補題之抽象的自我審題)抽象
- Educational Codeforces Round 53 (Rated for Div. 2) C. Vasya and Robot 二分+前字尾預處理
- Educational_round94題解
- 21 Educational Codeforces Round 136 (Rated for Div. 2)Knowledge Cards(樹狀陣列、set、+思維、數字華容道)陣列
- Educational Codeforces Round 53 (Rated for Div. 2) D. Berland Fair 二分+樹狀陣列 O(n*logn*logn) 思路AI陣列
- Codeforces
- [題解](A-G)Atcoder Educational DP Contest(更新中)