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. 为什么会出现Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 问题?

    问题描述:        把列表listview写入notebook里. 在main函数中, win = create_and_set_a_window(); book = gtk_notebook_ ...

  2. Android课程---Oracle VM VirtualBox出现不能为虚拟机打开一个新任务

    因工作需要在Win7下增添了Win7虚拟系统,随着VirtualBox 4.326的版本更新,用户们也开始升级.一用户在升级后发现原来创建的虚拟机无法打开,提示信息为:不能为虚拟电脑win7打开一个新 ...

  3. ThinkPHP 3.2.3 数据缓存与静态缓存

    ThinkPHP 3.2.3 中手册中数据缓存的地址是:http://www.kancloud.cn/manual/thinkphp/1835 静态缓存的地址是:http://www.kancloud ...

  4. python学习之 字符串前'r'的用法

    在打开文件的时候open(r'c:\....') 加r和不加''r是有区别的 'r'是防止字符转义的 如果路径中出现'\t'的话 不加r的话\t就会被转义 而加了'r'之后'\t'就能保留原有的样子 ...

  5. angular 路由去除#号

    1.  路由启动          $locationProvider.html5Mode(true);  通过pushstatex修改url app.js define([ 'angular', & ...

  6. T-sql创建表,插入数据

    SET NOCOUNT ON; USE hibernateSqlServer GO IF OBJECT_ID('Orders') IS NOT NULL DROP TABLE Orders; GO I ...

  7. MyBatis操作指南-配置结果映射一对一,一对多,多对多(基于注解)

  8. xib自定义cell代码规范

    // //  MJTgCell.m //  01-团购 // //  Created by apple on 14-4-1. //  Copyright (c) 2014年 itcast. All r ...

  9. HTTP协议 keep-alive连接 与 BS(firefox-thttpd)实验

    什么是 keep-alive 连接 https://en.wikipedia.org/wiki/HTTP_persistent_connection HTTP persistent connectio ...

  10. hadoop datanode启动失败

    问题导读: 1.Hadoop出现问题时,该如何入手查看问题?2.datanode无法启动,我们该怎么解决?3.如何动态加入DataNode或TaskTracker? 一.问题描述当我多次格式化文件系统 ...