Problem Description
ztr loves research Math.One day,He thought about the "Lower Edition" of triangle equation set.Such as n=x2−y2.

He wanted to know that ,for a given number n,is there a positive integer solutions?
Input
There are T test cases.
The first line of input contains an positive integer T(T<=) indicating the number of test cases. For each test case:each line contains a positive integer ,n<=.
Output
If there be a positive integer solutions,print True,else print False
 
Sample Input

Sample Output
False
True
True
True
Hint
For the fourth case,$ = ^{}-^{}$
 
给定nz,寻找是否存在一组(x,y),满足x^2-y^2=n,那么我们可以构造两个方程 即(k+1)^2-k^2=n和(k+1)^2-(k-1)^2=n,得出结论,当n为奇数或者4的倍数时,方程一定有正整数解,但要记得特判1和4
 
AC代码:
 #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
#define ll long long
ll n;
int main()
{
int t;
scanf("%d",&t);
while(t--){
scanf("%I64d",&n);
if(n== || n==){
printf("False\n");
continue;
}
if(n%== || n%==){
printf("True\n");
}else{
printf("False\n");
}
}
return ;
}

hdu 5675 ztr loves math(数学技巧)的更多相关文章

  1. HDU 5675 ztr loves math (数学推导)

    ztr loves math 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/A Description ztr loves re ...

  2. HDU 5675 ztr loves math

    ztr loves math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  3. hdu-5675 ztr loves math(数学)

    题目链接: ztr loves math  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Othe ...

  4. HDU 5677 ztr loves substring(Manacher+dp+二进制分解)

    题目链接:HDU 5677 ztr loves substring 题意:有n个字符串,任选k个回文子串,问其长度之和能否等于L. 题解:用manacher算法求出所有回文子串的长度,并记录各长度回文 ...

  5. HDU 5677 ztr loves substring(回文串加多重背包)

    ztr loves substring Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  6. HDU 5676 ztr loves lucky numbers (模拟)

    ztr loves lucky numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/I Description ztr ...

  7. hdu 5676 ztr loves lucky numbers(dfs+离线)

    Problem Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if the ...

  8. hdu 5676 ztr loves lucky numbers 打表+二分

    ztr loves lucky numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  9. HDU 5646 DZY Loves Partition 数学 二分

    DZY Loves Partition 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5646 Description DZY loves parti ...

随机推荐

  1. Mysql配置调优(转自阿铭论坛)

    Mysql配置文件my.cnf参数优化对于新手来讲,是比较难懂的东西,其实这个参数优化,是个很复杂的东西,对于不同的网站,及其在线量,访问量,帖子数量,网络情况,以及机器硬件配置都有关系,优化不可能一 ...

  2. angularJS自定义过滤器、服务和指令

    自定义过滤器 mainApp.filter('mayfilter',function(){ return function(input){ (过滤逻辑代码) } });   自定义创建指令 mainA ...

  3. ewebeditor下利用ckplayer增加html5 (mp4)全平台的支持

    学校数字化平台富文本编辑器一直用的ewebeditor,应该说非常的好,支持常用office文档的直接导入,极大的方便了老师们资料的上传,最近在规划整个数字化校园向全平台改版,框架采用bootstra ...

  4. Mac_配置adb环境变量

    1.打开终端Terminal. 2.进入HOME目录:命令行输入 echo(这之间有一个空格) $HOME 3.创建.bash_profile文件:命令行输入 touch(这之间有一个空格).bash ...

  5. 《第一行代码》学习笔记2-Android开发特色

    1.四大组件:活动(Activity),服务(Service),广播接收器(Broadcast Receiver),内容提供器(Content Provider). Activity:应用中看得到的东 ...

  6. 百度地图HTML接口

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  7. oracle 的服务器进程(PMON, SMON,CKPT,DBWn,LGWR,ARCn)

    来着TOM的<oracle 编程艺术 9i,10g,11g> PMON PMON,进程监视.PMON主要有3个用途: 1,在进程非正常中断后,做清理工作.例如:dedicated serv ...

  8. C# Winform中DataGridView的DataGridViewCheckBoxColumn CheckBox选中判断

    1.DataGridViewCheckBoxColumn CheckBox是否选中 在判断DataGridView中CheckBox选中列的时候,用DataGridViewRow.Cells[0].F ...

  9. android控制之 adb shell (已完成,不定期增加内容)

    第一步:首先,下载adb1.0.32.zip,里面有如下图的内容: 第二步:解压缩,复制Adb.exe,和fastboot.exe到System32,注意AdbWinUsbApi.dll,AdbWin ...

  10. liunx下安装mysql没有初始密码的解决方法

    #/etc/init.d/mysql stop #cd /usr/local/mysql #mysqld_safe --user=mysql --skip-grant-tables --skip-ne ...