CF1490C.Sum of Cubes

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

You are given a positive integer xx . Check whether the number xx is representable as the sum of the cubes of two positive integers.

Formally, you need to check if there are two integers aa and bb ( 1a,b1 \le a, b ) such that a3+b3=xa^3+b^3=x .

For example, if x=35x = 35 , then the numbers a=2a=2 and b=3b=3 are suitable ( 23+33=8+27=352^3+3^3=8+27=35 ). If x=4x=4 , then no pair of numbers aa and bb is suitable.

输入格式

The first line contains one integer tt ( 1t1001 \le t \le 100 ) — the number of test cases. Then tt test cases follow.

Each test case contains one integer xx ( 1x10121 \le x \le 10^{12} ).

Please note, that the input for some test cases won't fit into 3232 -bit integer type, so you should use at least 6464 -bit integer type in your programming language.

输出格式

For each test case, output on a separate line:

  • "YES" if xx is representable as the sum of the cubes of two positive integers.
  • "NO" otherwise.

You can output "YES" and "NO" in any case (for example, the strings yEs, yes, Yes and YES will be recognized as positive).

输入输出样例

  • 输入#1

    7
    1
    2
    4
    34
    35
    16
    703657519796

    输出#1

    NO
    YES
    NO
    NO
    YES
    YES
    YES

说明/提示

The number 11 is not representable as the sum of two cubes.

The number 22 is represented as 13+131^3+1^3 .

The number 44 is not representable as the sum of two cubes.

The number 3434 is not representable as the sum of two cubes.

The number 3535 is represented as 23+332^3+3^3 .

The number 1616 is represented as 23+232^3+2^3 .

The number 703657519796703657519796 is represented as 57793+799335779^3+7993^3 .

首页