数学--数论--hdu 6216 A Cubic number and A Cubic Number (公式推导)
A cubic number is the result of using a whole number in a multiplication three times.
For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and 125.
Given an prime number p. Check that if p is a difference of two cubic numbers.
Input
The first of input contains an integer T (1≤T≤100) which is the total number of test cases.
For each test case, a line contains a prime number p (2≤p≤1012).
Output
For each test case, output 'YES' if given p is a difference of two cubic numbers, or 'NO' if not.
Sample Input
10
2
3
5
7
11
13
17
19
23
29
Sample Output
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
int main()
{
int T;
scanf("%d", &T);
while (T--)
{
ll n;
scanf("%lld", &n);
if ((n - 1) % 3)
{
printf("NO\n");
continue;
}
ll x = (ll)sqrt((n - 1) / 3);
if (x * (x + 1) == (n - 1) / 3)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
数学--数论--hdu 6216 A Cubic number and A Cubic Number (公式推导)的更多相关文章
- 数学--数论-- HDU -- 2854 Central Meridian Number (暴力打表)
A Central Meridian (ACM) Number N is a positive integer satisfies that given two positive integers A ...
- 数学--数论--HDU - 6395 Let us define a sequence as below 分段矩阵快速幂
Your job is simple, for each task, you should output Fn module 109+7. Input The first line has only ...
- 数学--数论--HDU 2582 F(N) 暴力打表找规律
This time I need you to calculate the f(n) . (3<=n<=1000000) f(n)= Gcd(3)+Gcd(4)+-+Gcd(i)+-+Gc ...
- 数学--数论--HDU - 6322 打表找规律
In number theory, Euler's totient function φ(n) counts the positive integers up to a given integer n ...
- 数学--数论--hdu 5878 I Count Two Three(二分)
I will show you the most popular board game in the Shanghai Ingress Resistance Team. It all started ...
- 数学--数论-- HDU 2601 An easy problem(约束和)
Problem Description When Teddy was a child , he was always thinking about some simple math problems ...
- 数学--数论--HDU - 6124 Euler theorem (打表找规律)
HazelFan is given two positive integers a,b, and he wants to calculate amodb. But now he forgets the ...
- 数学--数论--HDU 6063 RXD and math (跟莫比乌斯没有半毛钱关系的打表)
RXD is a good mathematician. One day he wants to calculate: output the answer module 109+7. p1,p2,p3 ...
- 数学--数论--HDU 1299 +POJ 2917 Diophantus of Alexandria (因子个数函数+公式推导)
Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first ma ...
随机推荐
- Nginx-高性能的反向代理服务器
Nginx Nginx作为一款反向代理服务器,现在大多数网站都有使用,自己在项目中几乎都有用到,自己的网站也使用到了它. 了解Nginx 上面图可以直观的看出Nginx的用处,可以将请求转发至Web服 ...
- 关于web数据库的相关知识点的操作
主要是怎样建立与数据库的连接.对于框架是固定的: 下面是对于数据库的连接操作: package com.DBU; //数据库连接 import java.sql.Connection; import ...
- MTK Android Driver :Lcm
MTK Android Driver :lcm 1.怎样新建一个LCD驱动 LCD模组主要包括LCD显示屏和驱动IC.比如LF040DNYB16a模组的驱动IC型号为NT35510.要在MTK6577 ...
- 2020-3-15 20175110王礼博 Exp2后门原理与实践
目录 1.使用netcat获取主机操作Shell,cron启动 2.使用socat获取主机操作Shell, 任务计划启动 3.使用MSF meterpreter(或其他软件)生成可执行文件,利用nca ...
- Python操作rabbitmq系列(六):进行RPC调用
此刻,我们已经进入第6章,是官方的最后一个环节,但是,并非本系列的最后一个环节.因为在实战中还有一些经验教训,并没体现出来.由于马上要给同事没培训celery了.我也来不及写太多.等后面,我们再慢慢补 ...
- 运用JAVA的concurrent.ExecutorService线程池实现socket的TCP和UDP连接
运用JAVA的concurrent.ExecutorService线程池实现socket的TCP和UDP连接 最近在项目中可能要用到socket相关的东西来发送消息,所以初步研究了下socket的TC ...
- SSH、SCP命令及使用说明
SSH篇 1.ssh介绍 SSH是一种网络协议,用于计算机之间的加密登录.如果一个用户从本地计算机,使用SSH协议登录另一台远程计算机,我们就可以认为,这种登录是安全的,即使被中途截获,密码也不会泄露 ...
- 浏览器插件之王-Tampermonkey(油猴脚本)
大家电脑都在使用浏览器,相信大家对浏览器插件也不陌生,浏览器插件是安装在浏览器里面,对浏览器功能进行拓展的脚本,现在的主流浏览器都有各种各样的插件如图: 这些插件让我们的上网方便了许多,有去广告的插件 ...
- ES6系列-什么是ES6?新手应该怎么理解
ECMAScript 是什么 很多初学者都很困惑,ECMAScript是什么?它跟JavaScript有什么关系? 大家注意到了吗?从题目中我们就可以看出来了,ECMAScript是JavaScrip ...
- 数据库SQL---数据库系统概论
1.基本术语 1)信息:指数据加工处理后有用的数据. 2)信息的3种世界: (1)现实世界:存在于人脑之外的客观世界. (2)信息世界:现实世界在人脑中的反映. (3)数据世界:将信息世界中的信息通过 ...