CF1515B.Phoenix and Puzzle

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Phoenix is playing with a new puzzle, which consists of nn identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below.

A puzzle piece

The goal of the puzzle is to create a square using the nn pieces. He is allowed to rotate and move the pieces around, but none of them can overlap and all nn pieces must be used (of course, the square shouldn't contain any holes as well). Can he do it?

凤凰正在玩一个新拼图,该拼图由 nn 个完全相同的拼图块组成。每个拼图块是一个等腰直角三角形,如下图所示。

一个拼图块

该拼图的目标是用这 nn 个拼图块拼成一个正方形。允许对拼图块进行旋转和平移,但不允许重叠,且必须全部使用(当然,所拼成的正方形内部也不能有空洞)。他能做到吗?

输入格式

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

The first line of each test case contains an integer nn (1≤n≤1091 \le n \le 10^9) — the number of puzzle pieces.

输入包含多个测试用例。第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4),表示测试用例的数量。

每个测试用例的第一行包含一个整数 nn(1≤n≤1091 \le n \le 10^9),表示拼图块的数量。

输出格式

For each test case, if Phoenix can create a square with the nn puzzle pieces, print YES. Otherwise, print NO.

对于每个测试用例,如果凤凰能用这 nn 个拼图块拼出一个正方形,则输出 YES;否则输出 NO。

输入输出样例

  • 输入#1

    3
    2
    4
    6

    输出#1

    YES
    YES
    NO

说明/提示

For n=2n=2, Phoenix can create a square like this:

For n=4n=4, Phoenix can create a square like this:

For n=6n=6, it is impossible for Phoenix to create a square.

当 n=2n=2 时,凤凰可以构造如下正方形:

当 n=4n=4 时,凤凰可以构造如下正方形:

当 n=6n=6 时,凤凰无法构造出正方形。

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

首页