CF2253A.The Best Card

入门

通过率:0%

时间限制:2.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In a card game, there are nn cards with values 2,3,4,…,n+12, 3, 4, \ldots, n + 1.

To determine which of two cards with values xx and yy wins, apply the following rules:

  • if one of the numbers xx and yy is divisible by the other, the card with the smaller value wins;
  • otherwise, the card with the larger value wins.

For example, between cards 22 and 66, card 22 wins because 66 is divisible by 22. Between cards 44 and 66, card 66 wins because neither of these numbers is divisible by the other.

Determine whether there exists a card that wins against every other card.

在一种纸牌游戏中,有 nn 张牌,其牌面值分别为 2,3,4,…,n+12, 3, 4, \ldots, n + 1。

为判断两张牌面值分别为 xx 和 yy 的牌中哪张获胜,按以下规则判定:

  • 若 xx 与 yy 中有一个数能被另一个整除,则牌面值较小的牌获胜;
  • 否则,牌面值较大的牌获胜。

例如,在牌面值为 22 和 66 的两张牌之间,22 获胜,因为 66 能被 22 整除;在牌面值为 44 和 66 的两张牌之间,66 获胜,因为这两个数互不整除。

试判断是否存在一张牌,它能战胜其余所有牌。

输入格式

The first line contains an integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

The only line of each test case contains an integer nn (2≤n≤2⋅1052 \le n \le 2 \cdot 10^5) — the number of cards in the game.

Additional constraints on the input:

  • the sum of nn over all test cases does not exceed 3⋅1063 \cdot 10^6.

第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)——测试用例的数量。

每个测试用例仅一行,包含一个整数 nn(2≤n≤2⋅1052 \le n \le 2 \cdot 10^5)——游戏中卡片的数量。

输入的额外约束:

  • 所有测试用例的 nn 之和不超过 3⋅1063 \cdot 10^6。

输出格式

For each test case, print YES if there is a card that wins against all other cards, and NO otherwise.

Each letter may be printed in either case. For example, YES, yes, and yEs are all recognized as a positive answer.

对于每个测试用例,如果存在一张牌能击败所有其他牌,则输出 YES;否则输出 NO。

每个字母可使用大写或小写形式。例如,YES、yes 和 yEs 均被视为肯定回答。

输入输出样例

  • 输入#1

    5
    2
    3
    4
    5
    8

    输出#1

    YES
    NO
    YES
    NO
    NO

说明/提示

In the first test case, the available cards have values 22 and 33. Card 33 wins against card 22.

In the second test case, the available cards have values 22, 33, and 44. Card 22 wins against card 44, card 33 wins against card 22, and card 44 wins against card 33, so there is no suitable card.

在第一个测试用例中,可用的卡片数值为 22 和 33。卡片 33 战胜卡片 22。

在第二个测试用例中,可用的卡片数值为 22、33 和 44。卡片 22 战胜卡片 44,卡片 33 战胜卡片 22,卡片 44 战胜卡片 33,因此不存在合适的卡片。

输入解题思路,AI测评打分。不知道怎么写?

首页