310313: CF1814A. Coins
Description
In Berland, there are two types of coins, having denominations of $2$ and $k$ burles.
Your task is to determine whether it is possible to represent $n$ burles in coins, i. e. whether there exist non-negative integers $x$ and $y$ such that $2 \cdot x + k \cdot y = n$.
InputThe first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of test cases.
The only line of each test case contains two integers $n$ and $k$ ($1 \le k \le n \le 10^{18}$; $k \ne 2$).
OutputFor each test case, print YES if it is possible to represent $n$ burles in coins; otherwise, print NO. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).
ExampleInput4 5 3 6 1 7 4 8 8Output
YES YES NO YESNote
In the first test case, you can take one coin with denomination $2$ and one coin with denomination $k = 3$.
In the second test case, you can take three coins with denomination $2$. Alternatively, you can take six coins with denomination $k = 1$.
In the third test case, there is no way to represent $7$ burles.
In the fourth test case, you can take one coin with denomination $k = 8$.
Input
题意翻译
**本题一共有 $t$ 组数据。** 每组数据包含两个整数 $n$ 和 $k$,如果存在两个非负整数 $x,y$,满足 $2\times x+k\times y=n$,输出 `YES`,否则输出 `NO`(`yes`,`Yes`,`NO`,`nO` 均可)。 by [ydq1101](https://www.luogu.com.cn/user/672281) 2023.4.7Output
在贝尔兰德国有两种硬币,面值分别为2和k伯尔。你的任务是确定是否可以用这些硬币表示n伯尔,即是否存在非负整数x和y,使得 \( 2 \cdot x + k \cdot y = n \)。
输入数据格式:
第一行包含一个整数t(1 ≤ t ≤ 10^4)——测试用例的数量。
每个测试用例只有一行,包含两个整数n和k(1 ≤ k ≤ n ≤ 10^18;k ≠ 2)。
输出数据格式:
对于每个测试用例,如果可以用硬币表示n伯尔,则输出YES;否则输出NO。每个字母可以是大写或小写(YES, yes, Yes都将被视为肯定答案,NO, no, nO都将被视为否定答案)。题目大意: 在贝尔兰德国有两种硬币,面值分别为2和k伯尔。你的任务是确定是否可以用这些硬币表示n伯尔,即是否存在非负整数x和y,使得 \( 2 \cdot x + k \cdot y = n \)。 输入数据格式: 第一行包含一个整数t(1 ≤ t ≤ 10^4)——测试用例的数量。 每个测试用例只有一行,包含两个整数n和k(1 ≤ k ≤ n ≤ 10^18;k ≠ 2)。 输出数据格式: 对于每个测试用例,如果可以用硬币表示n伯尔,则输出YES;否则输出NO。每个字母可以是大写或小写(YES, yes, Yes都将被视为肯定答案,NO, no, nO都将被视为否定答案)。