4436: Easy Math

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.scu.edu.cn/soj/problem.action?id=4436

Description

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

HINT

题意

让你判断给你的n个数的根号和是否为整数

题解:

(ll)sum==sum就好了

代码:

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 100001
#define mod 10007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** int main()
{
int n;
while(cin>>n)
{
double sum=;
double x;
for(int i=;i<n;i++)
{
scanf("%lf",&x);
sum+=sqrt(x);
}
if((ll)sum==sum)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}

scu 4436: Easy Math 水题的更多相关文章

  1. 数学 SCU 4436 Easy Math

    题目传送门 /* 数学题:当有一个数开根号后是无理数,则No */ #include <cstdio> #include <algorithm> #include <cs ...

  2. SCU 4436 Easy Math 2015年四川省赛题

    题目链接:http://acm.scu.edu.cn/soj/problem/4436/ 题意:给你n个整数,求这n个数的平方根和是否是一个整数: 解题思路:如果这题每个数给他算出来,必然费时间,可能 ...

  3. CodeForces 690C1 Brain Network (easy) (水题,判断树)

    题意:给定 n 条边,判断是不是树. 析:水题,判断是不是树,首先是有没有环,这个可以用并查集来判断,然后就是边数等于顶点数减1. 代码如下: #include <bits/stdc++.h&g ...

  4. Gym 100851E Easy Problemset (水题,模拟)

    题意:给定 n 个裁判,然后每个都一些题目,现在要从每一个按顺序去选出 k 个题,并且这 k 个要按不递减顺序,如果没有,就用50补充. 析:就按他说的来,直接模拟就好. 代码如下: #pragma ...

  5. Codeforces Round #599 (Div. 2) B1. Character Swap (Easy Version) 水题

    B1. Character Swap (Easy Version) This problem is different from the hard version. In this version U ...

  6. Codeforces - 1195D1 - Submarine in the Rybinsk Sea (easy edition) - 水题

    https://codeforc.es/contest/1195/problem/D1 给\(n\)个等长的十进制数串,定义操作\(f(x,y)\)的结果是"从\(y\)的末尾开始一个一个交 ...

  7. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  8. Brain Network (easy)(并查集水题)

    G - Brain Network (easy) Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  9. UPC 2959: Caoshen like math 这就是个水题

    http://acm.upc.edu.cn/problem.php?id=2959 这就是个水题,之所以要写这个题是感觉很有纪念意义 用力看就是盲……23333333333333333 这个题就是最小 ...

随机推荐

  1. 11、NFC技术:NDEF Uri格式解析

    NDEF Uri格式规范 与NDEF文本格式一样,存储在NFC标签中的Uri也有一定的格式 http://www.nfc-forum.org/specs/spec_dashboard 编写可以解析Ur ...

  2. python3 多线程的基本用法

    #coding=utf-8 import threading #导入threading包 from time import sleep import time   def task1():     p ...

  3. Markdown 是什么?

    这是一篇 Markdown 学习笔记,简要记录常用 Markdown 语法. Markdown 是什么? Markdown 是一种轻量级标记语言,创始人为约翰·格鲁伯(John Gruber)和亚伦· ...

  4. STL map 用法

    首先make_pair Pairs C++标准程序库中凡是"必须返回两个值"的函数, 也都会利用pair对象  class pair可以将两个值视为一个单元.容器类别map和mul ...

  5. JavaScript高级程序设计(第三版)第三章 基本概念

    3.3 变量 在使用var声明但未对其加以初始化时,这个变量的值就是undefinded. var message; //这个变量声明之后默认取得了undefinded值 //下面这个变量并没有声明 ...

  6. CSS抗锯齿 font-smoothing

    CSS3里面加入了一个“-webkit-font-smoothing”属性. 这个属性可以使页面上的字体抗锯齿,使用后字体看起来会更清晰舒服. 加上之后就顿时感觉页面小清晰了. 淘宝也在用哦! 它有三 ...

  7. ubuntu下apt-get update出现hash校验和错误

    可能原因 校园网进行网络缓存导致内容滞后. 解决办法 先清除旧的apt-get更新列表 sudo rm -rf /var/lib/apt/lists/* 使用代理服务器或者VPN 重新更新 sudo ...

  8. HW7.15

    public class Solution { public static void main(String[] args) { double[][] set1 = {{1, 1}, {2, 2}, ...

  9. dom 拖拽div

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  10. share-jquery

    html val text区别: .html()用为读取和修改元素的HTML标签 .text()用来读取或修改元素的纯文本内容 .val()用来读取或修改表单元素的value值. 这三个方法功能上的对 ...