pastebin

Paste Search Dynamic
Recent pastes
cinArray
  1. #include <bits/stdc++.h>
  2.  
  3. typedef long long ll;
  4. using namespace std;
  5.  
  6. void cinArray(int len, ll arr[]) {
  7.         for (int i = 0; i < len; i++)
  8.         {
  9.                 cin >> arr[i];
  10.         }
  11. }
  12.  
  13. bool check(string s,int n) {
  14.         int count = 0;
  15.         for (int i = 0; i < s.length(); i++) {
  16.                 if (s[i] == '_')
  17.                         count++;
  18.                 if (count > n-1)
  19.                         return false;
  20.         }
  21.         if (count < n-1)
  22.                 return false;
  23.         else
  24.                 return true;
  25. }
  26.  
  27. int main() {
  28.         int t;
  29.         cin >> t;
  30.         while (t--) {
  31.                 ll n, k;
  32.                 cin >> n >> k;
  33.                 ll c = k, count = 1;
  34.                 if (k >= 2) {
  35.                         while (n > c) {
  36.                                 c += k;
  37.                                 count++;
  38.                         }
  39.                         if (count % 2 != 0)
  40.                         {
  41.                                 cout << "YES" << endl;
  42.                         }
  43.                         else {
  44.                                 if (k % 2 == 0)
  45.                                         cout << "NO" << endl;
  46.                                 else {
  47.                                         int a = (int) floor(k / 2);
  48.                                         if (c - a == n)
  49.                                                 cout << "YES" << endl;
  50.                                         else
  51.                                                 cout << "NO" << endl;
  52.                                 }
  53.                         }
  54.                 }
  55.                 else
  56.                 {
  57.                         cout << "YES" << endl;
  58.                 }
  59.         }
  60. }
Parsed in 0.017 seconds