-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2014B.cpp
More file actions
41 lines (34 loc) · 835 Bytes
/
2014B.cpp
File metadata and controls
41 lines (34 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
using namespace std;
int sum(int arr[], int n){
int total = 0;
for(int i = 0; i < n; i++){
total += arr[i];
}
return total;
}
void solve(int t){
long long n, k;
for(int i = 0; i < t; i++){
cin >> n >> k;
long long m = (k < n ? k : n); // alive years
long long start = n - m + 1; // first alive year
long long len = m; // number of years alive
long long oddCount;
if(start % 2 == 0){
oddCount = len / 2;
} else {
oddCount = (len + 1) / 2;
}
if(oddCount % 2 == 0){
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
}
int main(){
int t;
cin >> t;
solve(t);
}