最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊

CF 1814A - Coins

2023-07-20 15:12 作者:您是打尖兒還是住店呢  | 我要投稿

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í)候才組成不了,其他都可以。


CF 1814A - Coins的評論 (共 條)

分享到微博請遵守國家法律
鄯善县| 永定县| 陕西省| 昭觉县| 遂宁市| 邵阳市| 灯塔市| 彭阳县| 得荣县| 彰化县| 龙海市| 集贤县| 迭部县| 黎川县| 准格尔旗| 射洪县| 瑞昌市| 丰宁| 山东| 崇礼县| 龙江县| 临安市| 松阳县| 宁武县| 洪雅县| 麦盖提县| 西华县| 唐海县| 台江县| 望江县| 青岛市| 中山市| 许昌市| 茶陵县| 荆州市| 郧西县| 房产| 曲沃县| 闽侯县| 永平县| 池州市|