2015弱校联盟(1) -A. Easy Math
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的更多相关文章
- 2015弱校联盟(2) - J. Usoperanto
J. Usoperanto Time Limit: 8000ms Memory Limit: 256000KB Usoperanto is an artificial spoken language ...
- 2015弱校联盟(1) - C. Censor
C. Censor Time Limit: 2000ms Memory Limit: 65536KB frog is now a editor to censor so-called sensitiv ...
- 2015弱校联盟(1) - B. Carries
B. Carries Time Limit: 1000ms Memory Limit: 65536KB frog has n integers a1,a2,-,an, and she wants to ...
- 2015弱校联盟(1) - I. Travel
I. Travel Time Limit: 3000ms Memory Limit: 65536KB The country frog lives in has n towns which are c ...
- 2015弱校联盟(1) -J. Right turn
J. Right turn Time Limit: 1000ms Memory Limit: 65536KB frog is trapped in a maze. The maze is infini ...
- 2015弱校联盟(1) - E. Rectangle
E. Rectangle Time Limit: 1000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java class name ...
- 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 ...
- (2016弱校联盟十一专场10.5) F. Fibonacci of Fibonacci
题目链接 题目大意就是这个,先找出下标的循环节,再快速幂对20160519取余就行了. 找出下标循环节: #include <cstdio> #include <iostream&g ...
- (2016弱校联盟十一专场10.3) D Parentheses
题目链接 把左括号看成A右括号看成B,推一下就行了.好久之前写的,推到最后发现是一个有规律的序列. #include <bits/stdc++.h> using namespace std ...
随机推荐
- Iconfont矢量图标平台全面升级
阿里UX矢量图标库今天全新发布上线了,这次升级相对于老版本做了30多项功能和体验上的改善:赶快来体验一下吧!! 请猛戳:www.iconfont.cn 请猛戳:www.iconfont.cn 设计师p ...
- centos下安装mysql遇到的问题
我前边遇到的坎,竟然和这篇百度经验惊人的相似,他帮我大忙了,十分感谢作者啊,连接双手奉上http://jingyan.baidu.com/article/ce436649fec8533773afd38 ...
- PHP filesystem attack vectors
http://www.ush.it/2009/02/08/php-filesystem-attack-vectors/ On Apr 07, 2008 I spoke with Kuza55 and ...
- 一段能导致火狐、谷歌Safari浏览器崩溃,甚至让iPhone重启的代码
JavaScript代码,能导致火狐.谷歌Safari浏览器崩溃,甚至让iPhone重启 <html> <body> <script> var total = &q ...
- Cocos2d-x 开发 v3.2 建立新项目并添加库文件
一.添加其它类库 3.0以上的设计耦合性强,项目中模块常以库的形式存在,需常添加链接库.在3.0中经常用到CocoStudio 编辑器的资源数据,所以需要添加CocoStudio 库. 1.1 ...
- Python中的属性管理
Python管 理属性的方法一般有三种:操作符重载(即,__getattr__.__setattr__.__delattr__和 __getattribute__,有点类似于C++中的重载操作符).p ...
- papi酱视频因违规遭下线整改,你知道原因吗?
今日4月18日,在微信上的一篇<papi酱遭广电总局封杀 罗振宇1200万恐打水漂>的文章迅速转了起来,说的就是现在网红第一人“papi酱”的视频被广电总局责令下架的消息.箭头直指papi ...
- react-native 问题总结
给npm换源 1.通过config配置指向国内源 npm config set registry http://registry.cnpmjs.org //配置指向源 npm info express ...
- wp插件
- JMeter学习-007-JMeter 断言实例之一 - 响应断言
之前的文章中已经对如何录制 web 的请求进行了详细的描述,敬请参阅:JMeter学习-004-WEB脚本入门实战 同时,我们的手机应用(例如:京东.天猫.唯品会.携程.易迅 等等 App)所发出的请 ...