2017青岛网络赛1011 A Cubic number and A Cubic Number
A Cubic number and A Cubic Number
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 4947 Accepted Submission(s): 1346
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.
is the total number of test cases.
For each test case, a line contains a prime number p (2≤p≤1012).
a difference of two cubic numbers, or 'NO' if not.
2
3
5
7
11
13
17
19
23
29
NO
NO
YES
NO
NO
NO
YES
NO
NO
Statistic | Submit | Clarifications | Back
#include <math.h>
#include<iostream>
#include<vector>
#define ll long long int
using namespace std;
vector<ll> t_vec;
bool fun(ll a) {
a = (a - 1);
if (a % 3 != 0) {
return false;
}
a = a / 3;
ll tem = sqrt(a);
if (tem*(tem + 1) == a)
return true;
else
return false;
}
int main() {
int t;
ll n;
cin >> t;
while (t--) {
cin >> n;
if (fun(n))
cout << "YES\n";
else
cout << "NO\n";
}
return 0;
}
2017青岛网络赛1011 A Cubic number and A Cubic Number的更多相关文章
- HDU 6212 Zuma 2017青岛网络赛 区间DP
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6212 解法:看了眼题就发现这个BZOJ 1032不是一毛一样?但是BZOJ上那是个巨坑,数据有错,原来 ...
- 2017青岛网络赛1008 Chinese Zodiac
Chinese Zodiac Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) T ...
- 2017 青岛网络赛 Chenchen, Tangtang and ZengZeng
Chenchen, Tangtang and ZengZeng are starting a game of tic-tac-toe, played on a 3 × 3 board. Initial ...
- HDU 4758 Walk Through Squares (2013南京网络赛1011题,AC自动机+DP)
Walk Through Squares Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Oth ...
- hdu5017:补题系列之西安网络赛1011
补题系列之西安网络赛1011 题目大意:给定一个椭球: 求它到原点的最短距离. 思路: 对于一个椭球的标准方程 x^2/a^2 + y^2/b^2 +z^2/c^2=1 来说,它到原点的最短距离即为m ...
- HDU 5880 Family View (2016 青岛网络赛 C题,AC自动机)
题目链接 2016 青岛网络赛 Problem C 题意 给出一些敏感词,和一篇文章.现在要屏蔽这篇文章中所有出现过的敏感词,屏蔽掉的用$'*'$表示. 建立$AC$自动机,查询的时候沿着$fa ...
- 2017乌鲁木齐网络赛 j 题
题目连接 : https://nanti.jisuanke.com/t/A1256 Life is a journey, and the road we travel has twists and t ...
- hdu 6152 : Friend-Graph (2017 CCPC网络赛 1003)
题目链接 裸的结论题.百度 Ramsey定理.刚学过之后以为在哪也不会用到23333333333,没想到今天网络赛居然出了.顺利在题面更改前A掉~~~(我觉得要不是我开机慢+编译慢+中间暂时死机,我还 ...
- 2017 ICPC网络赛(西安)--- Xor
题目连接 Problem There is a tree with n nodes. For each node, there is an integer value ai, (1≤ai≤1,000 ...
随机推荐
- fastcgi与cgi的区别[转载]
cgi 在2000年或更早的时候用得比较多, 以前web服务器一般只处理静态的请求,如果碰到一个动态请求怎么办呢?web服务器会根据这次请求的内容,然后会fork一个新进程来运行外部c程序 (或per ...
- 18.9.22 noip模拟赛
此题为找规律.期望100 实际100 #include<cstdio> #include<cstring> #include<iostream> #include& ...
- sqlit中使用到的查询语句
近期使用sqlite查询比較多,包含连表查询等. 记录一下.以免忘记! 1.先依据时间排序后选择前十条: select * from MyBill order by createTime desc ...
- mainboard
MAINBOARD ★ CPU(type, speed, amount, cache, slot or socket, fan) ★ RAM(the most capacity, amount, fr ...
- NA路由②
CISCO常见的命令语法: R(c)#ip route network {mask} address/interface : 参数 {}可选项 ...
- Java设计模式—单例设计模式(Singleton Pattern)全然解析
转载请注明出处:http://blog.csdn.net/dmk877/article/details/50311791 相信大家都知道设计模式,听的最多的也应该是单例设计模式,这种模式也是在开发中用 ...
- .Net 与 Javascript 混合编程系列
之前的文章有提到 edge 和 nodejs 交互,通过node的模块为C# 提供一些扩展,这个还是比較方便. 这里说下为什么要使用js. 1.SharpKit是一个用于在编译时将C#语言转换为Jav ...
- OpenFileDiag 使用
MSDN模版 Stream myStream =null; OpenFileDialog openFileDialog1 =newOpenFileDialog(); openFileDialog1.I ...
- TCP/IP具体解释学习笔记——数据链路层(2)
五 Wireless LANs(Wi-Fi) 现在很流行的一种接入互联网的方式就是Wi-Fi了.我们用的ipad.手机.笔记本电脑等等都能够用这样的方式接入互联网,很方便灵活.一个典型的Wi-Fi网络 ...
- 【bzoj4385】[POI2015]Wilcze doły
单调队列扫描,记录当前区间长度为d的一段的和的最大值,和当前区间和. #include<algorithm> #include<iostream> #include<cs ...