题目链接:

Lucky

Time Limit: 2000/1000 MS (Java/Others)  

  Memory Limit: 65536/65536 K (Java/Others)

Problem Description
 
    Chaos August likes to study the lucky numbers.

For a set of numbers S,we set the minimum non-negative integer,which can't be gotten by adding the number in S,as the lucky number.Of course,each number can be used many times.

Now, given a set of number S, you should answer whether S has a lucky number."NO" should be outputted only when it does have a lucky number.Otherwise,output "YES".

 
Input
 
    The first line is a number T,which is case number.

In each case,the first line is a number n,which is the size of the number set.

Next are n numbers,means the number in the number set.

1≤n≤10^5,1≤T≤10,0≤ai≤10^9.

 
Output
 
  Output“YES”or “NO”to every query.
 
Sample Input
 
1
1
2
 
Sample Output
 
NO
 
题意:
 
问给的这个集合,能否用这个集合的数相加得到任意的自然数,每个数可以用无数遍;
 
思路:
 
只要有0和1就可以得到所有的自然数;
 
AC代码:
 
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
const ll mod=1e9+;
const int N=1e5+;
int n,a[N];
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
int flag1=,flag2=;
for(int i=;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]==)flag1=;
if(a[i]==)flag2=;
}
if(flag1&&flag2)printf("YES\n");
else printf("NO\n");
} return ;
}
 

hdu-5665 Lucky(水题)的更多相关文章

  1. hdu 5210 delete 水题

    Delete Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5210 D ...

  2. hdu 1251 (Trie水题)

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submi ...

  3. HDU 5665 Lucky (水题)

    Lucky 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/G Description Chaos August likes to ...

  4. HDU 5703 Desert 水题 找规律

    已知有n个单位的水,问有几种方式把这些水喝完,每天至少喝1个单位的水,而且每天喝的水的单位为整数.看上去挺复杂要跑循环,但其实上,列举几种情况之后就会发现是找规律的题了= =都是2的n-1次方,而且这 ...

  5. HDU 4493 Tutor 水题的收获。。

    题目: http://acm.hdu.edu.cn/showproblem.php?pid=4493 题意我都不好意思说,就是求12个数的平均数... 但是之所以发博客,显然有值得发的... 这个题最 ...

  6. hdu 4802 GPA 水题

    GPA Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Des ...

  7. hdu 4493 Tutor 水题

    Tutor Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4493 D ...

  8. hdu 5495 LCS 水题

    LCS Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5495 Descr ...

  9. hdu 4891 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...

  10. hdu 5734 Acperience 水题

    Acperience 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5734 Description Deep neural networks (DN ...

随机推荐

  1. iOS开发 Coretext基本用法

    转至 http://blog.csdn.net/fengsh998/article/details/8691823 API接口文档. https://developer.apple.com/libra ...

  2. python pyqtgraph 保存图片到本地

    pyqtgraph官方给的示例居然会报错2333 官方文档传送门:#####pyqtgraph export pyqtgraph支持在可视化窗口中右键保存(Exporting from the GUI ...

  3. 纯JS设置首页,增加收藏,获取URL參数,解决中文乱码

    雪影工作室版权全部,转载请注明[http://blog.csdn.net/lina791211] 1.前言 纯Javascript 设置首页,增加收藏. 2.设置首页 // 设置为主页 functio ...

  4. 使用Android注解来改善代码

    昨晚看到一篇好文章.然后是英文的.所以决定翻译分享给大家.这是原文链接:http://www.michaelevans.org/blog/2015/07/14/improving-your-code- ...

  5. iterm2 配色

    http://blog.csdn.net/sanwuhai/article/details/48729561

  6. python(7)- 小程序练习:循环语句for,while实现99乘法表

    打印99乘法表 for 循环语句实现: for i in range(1,10): for j in range(1,10): print(j,"x",i,"=" ...

  7. 关于mysql engine(引擎)的疑问

    http://bbs.chinaunix.net/thread-989698-1-1.html

  8. PHP中的$_SERVER['PATH_INFO']

    PHP中的全局变量$_SERVER['PATH_INFO']是一个很有用的参数,众多的CMS系统在美化自己的URL的时候,都用到了这个参数. 对于下面这个网址: http://www.test.com ...

  9. Android - Activity定制横屏(landscape)显示

    Activity定制横屏(landscape)显示 本文地址: http://blog.csdn.net/caroline_wendy Android横屏(landscape)显示:  android ...

  10. OpenCV load 运行出错 cv::Exception 出错

    今天在使用OpenCV的load函数时,出现错误,代码如下: cascade = (CvHaarClassifierCascade*)cvLoad( cascade_name, 0, 0, 0 ); ...