A. Easy Math

Time Limit: 2000ms

Memory Limit: 65536KB

Given n integers a1,a2,…,an, check if the sum of their square root a1−−√+a2−−√+⋯+an−−√ is a integer.

Input

The input consists of multiple tests. For each test:

The first line contains 1 integer n (1≤n≤105).

The second line contains n integers a1,a2,…,an (0≤ai≤109).

Output

For each test, write ‘‘Yes′′ if the sum is a integer, or ‘‘No′′ otherwise.

Sample Input

2

1 4

2

2 3

Sample Output

Yes

No

判断每一个数是不是平方数,如果不是平方数,最后的结果不是整数

#include <bits/stdc++.h>
#define LL long long
#define fread() freopen("in.in","r",stdin)
#define fwrite() freopen("out.out","w",stdout) using namespace std; int main()
{
int n,data;
while(~scanf("%d",&n))
{
bool flag=false;
while(n--)
{
scanf("%d",&data);
if(flag)
{
continue;
}
int ans=(int)sqrt(data);
if(ans*ans!=data)//判断是不是平方数
{
flag=true;
}
}
if(flag)
{
cout<<"No"<<endl;
}
else
{
cout<<"Yes"<<endl;
}
}
return 0;
}

2015弱校联盟(1) -A. Easy Math的更多相关文章

  1. 2015弱校联盟(2) - J. Usoperanto

    J. Usoperanto Time Limit: 8000ms Memory Limit: 256000KB Usoperanto is an artificial spoken language ...

  2. 2015弱校联盟(1) - C. Censor

    C. Censor Time Limit: 2000ms Memory Limit: 65536KB frog is now a editor to censor so-called sensitiv ...

  3. 2015弱校联盟(1) - B. Carries

    B. Carries Time Limit: 1000ms Memory Limit: 65536KB frog has n integers a1,a2,-,an, and she wants to ...

  4. 2015弱校联盟(1) - I. Travel

    I. Travel Time Limit: 3000ms Memory Limit: 65536KB The country frog lives in has n towns which are c ...

  5. 2015弱校联盟(1) -J. Right turn

    J. Right turn Time Limit: 1000ms Memory Limit: 65536KB frog is trapped in a maze. The maze is infini ...

  6. 2015弱校联盟(1) - E. Rectangle

    E. Rectangle Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java class name ...

  7. 2016弱校联盟十一专场10.5---As Easy As Possible(倍增)

    题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8506#problem/A problem description As we know, t ...

  8. (2016弱校联盟十一专场10.5) F. Fibonacci of Fibonacci

    题目链接 题目大意就是这个,先找出下标的循环节,再快速幂对20160519取余就行了. 找出下标循环节: #include <cstdio> #include <iostream&g ...

  9. (2016弱校联盟十一专场10.3) D Parentheses

    题目链接 把左括号看成A右括号看成B,推一下就行了.好久之前写的,推到最后发现是一个有规律的序列. #include <bits/stdc++.h> using namespace std ...

随机推荐

  1. 手机触屏触摸特效javascript-TouchSwipe(依赖于jquery库)中文说明

    by 郑州seo on 2013 年 7 月 6 日 in jquery, 网站建设 with 6 Comments 最近需要做一个手机小门户网站,因为目前主流的手机都是安卓和苹果的,他们的浏览器内核 ...

  2. Joomla 3.2.0 - 3.4.4 无限制SQL注入漏洞

    http://www.sebug.net/vuldb/ssvid-89680#0-tsina-1-18081-397232819ff9a47a7b7e80a40613cfe1 http://10.21 ...

  3. 2016HUAS暑假集训题1 H - N皇后问题

    Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上. 你的任务是,对于给定的N,求出有多少种合 ...

  4. 微信公众号内H5调用微信支付国内服务商模式

    最近在折微信公众号内H5用JSAPI调用微信支付,境内服务商版支付,微信支付给出的官方文档以及SDK不够详细,导至我们走了一些弯路,把他分享出来,我这边主要是用PHP开发,所以未加说的话示例都是PHP ...

  5. DataTable to byte[]、DataTable to XML(string)

    DataTabe 对象在很多地方都会用到,特别是在Web Service.Socket等需网络传输的地方. 但是在有些地方,如果直接传递的话,程序可能会报告DataTable无法序列化错误. 解决问题 ...

  6. html本地服务器

    html本地服务器 http://files.cnblogs.com/files/douxuyao/Aws.rar

  7. .net获取select控件中的文本内容

    .net获取select控件中的文本内容 2009-11-28 21:19小V古 | 分类:C#/.NET | 浏览1374次 <select id="SecType" st ...

  8. Android课程---String、StringBuffer 、StringBuilder 的区别(转)

    String 字符串常量 StringBuffer 字符串变量(线程安全) StringBuilder 字符串变量(非线程安全)  简要的说, String 类型和 StringBuffer 类型的主 ...

  9. centos yum 使用笔记

    yum 参数说明yum -y # 表示自动选择 基本使用# yum -y install 包名(支持*) :自动选择y,全自动# yum install 包名(支持*) :手动选择y or n# yu ...

  10. Jquery--防止冒泡

    e.stopPropagation();//阻止冒泡