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 ...
随机推荐
- Date类型-演示JS中的日期
<script type="text/javascript"> /* *演示JS中的日期 */ var date = new Date(); document.writ ...
- Sqlserver2008和Oracle分页语句
SqlServer 分页语句 select StuID ,StuNo,StuName,Age,Sex, ClassName ClassName from (select *, row_number() ...
- 20145209&20145309信息安全系统设计基础实验报告 (4)
实验步骤 阅读和理解源代码 demo_read,demo_write 函数完成驱动的读写接口功能,do_write 函数实现将用户写入的数据逆序排列,通过读取函数读取转换后的数据.这里只是演示接口的实 ...
- C#对泛型List<T>系列化与反系列化
练习一个小例子,在C#中,怎样对泛型List<T>数据集进行系列化与反系列化.我们先了解msdn提供的JavaScriptSerializer类: JavaScriptSerializer ...
- oslo.messaging 1.8.0 bug fix and blueprint
1366597 由于amqp_auto_delete可配置,但是NotifierPublisher使用的是没有在配置中获取而使用的默认的False,即非auo_delete,因而在用户配置了amqp_ ...
- xampp使用phpunit
1.将xampp/php的pear文件夹里面的phpunit文件夹复制到htdocs目录下 2.复制xampp/php的phpunit.bat到需要测试的目录 3.使用cmd命令切换至phpunit. ...
- NumberPicker设置宽度,设置文字颜色
修改宽度 wheel = (NumberPicker) findViewById(R.id.info_wheel_province); wheel.setLayoutParams(new Linear ...
- 基于VirtualBox的多重载入
问题描述 这个问题要追溯到中秋之前,也就是写第一周博客的时候,当时我用的还是虚拟机上的ubuntu:当时我的ubuntu不是最新版,所以有提示升级,你懂的,我升了(因为时间有点久,我先去吃了个饭):等 ...
- 使用swfupload上传超过30M文件,使用FLASH上传组件
原文:使用swfupload上传超过30M文件,使用FLASH上传组件 前一段时间会员的上传组件改用FLASH的swfupload来上传,既能很友好的显示上传进度,又能完全满足大文件的上传. 后来服务 ...
- Android You need to use a Theme.AppCompat theme (or descendant) with this activity.
错误描述为:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with ...