CF 1814A - Coins
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?x+k?y=n.
Input
The first line contains a single integer t (1≤t≤104) — the number of test cases.
The only line of each test case contains two integers n and k (1≤k≤n≤1018; k≠2).
Output
For 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).
-------------------------------------------
在貝爾蘭,有兩種硬幣,面值分別為 2 伯勒和 k 伯勒。
你的任務(wù)是確定是否可以用硬幣 i 來表示 n 個(gè) burles。 e. 是否存在非負(fù)整數(shù) x 和 y 使得 2?x+k?y=n。
輸入
第一行包含一個(gè)整數(shù) t (1≤t≤104) — 測試用例的數(shù)量。
每個(gè)測試用例的唯一行包含兩個(gè)整數(shù)n和k(1≤k≤n≤1018;k≠2)。
輸出
對于每個(gè)測試用例,如果可以用硬幣表示n個(gè)burles,則打印YES; 否則,打印NO。 您可以在任何情況下打印每個(gè)字母(YES、yes、Yes 都將被識別為肯定答案,NO、no 和 nO 都將被識別為否定答案)。
----------------------------------------------
發(fā)現(xiàn)了,我就只能做做AB類的題目,C的都差很多,遙遙無期的刷題路啊。。。。
這里面只有k是偶數(shù),n為奇數(shù)的時(shí)候才組成不了,其他都可以。