题目链接:

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. 在CentOS上安装 MongoDB

    安装是在线安装方式,因此必须先保证能正常上网. 安装mongodb,官方的安装文档,是在线安装方式: https://docs.mongodb.com/manual/tutorial/install- ...

  2. uitableview执行deleteRowsAtIndexPaths时出错

    Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid updat ...

  3. Android Studio apk 打包流程(转)http://blog.chinaunix.net/uid-26000296-id-5567890.html

    1.Build -> Generate Signed APK...,打开如下窗口 2.假设这里没有打过apk包,点击Create new,窗口如下 这里只要输入几个必要项 Key store p ...

  4. mysql数据库连接状态,不要做修改数据库表结构的操作;数据库迁移操作;

    在开发过程中,python的flask框架使用sqlalmysql连接mysql数据库. 在程序连接数据量过程中,不要修改数据表的结构.比如在连接状态中使用下面的软件修改数据表结构,这个软件立即就会卡 ...

  5. angular md-toast 颜色

    How to show md-toast with background color https://codepen.io/neilkalman/pen/jWBqve <div ng-contr ...

  6. 【搞机】9.7英寸iPad Pro 上手开箱(图文)

    前言 话说,去年就一直想买个iPad ,可是苦于iPad air 2 出的太早,立即就要更新了,就没有买. 今年出了9.7英寸的iPad Pro .看到添加了这么多新特性.就按耐不住心情预订了~ 还刻 ...

  7. Redux作用

    作用:Redux是为了解决React中组件与组件之间数据传递的问题. React组件之间的传递有三种情况:1.父组件传递数据给子组件:由于redux是一个单向数据流的框架,所以它的数据就只能由父组件传 ...

  8. PCIE、UART、HDA、I2C、SMBUS、SPI、eSPI、USB、PS2、CAN、SDIO等数据传输协议简介

    M.2 wife一般支持USB.SDIO.PCIE三种传输 1.摄像头 (1)MIPI CSI (2)USB mipi摄像头模组IC简单便宜(小),应为一般把ADC解码在CPU端. MIPI摄像头简介 ...

  9. Ubuntu 登陆异常-输入正确的密码后还会返回到登陆界面的问题

    问题表现: 启动到了登陆界面,输入对应的密码,发现一闪黑屏有返回到登陆界面,如此往复. 解决方法: 开机后在登陆界面按下shift + ctrl + F1进入tty命令行终端登陆,可以查看用户主目录下 ...

  10. man screen

    http://www.gnu.org/software/screen/manual/screen.html Screen User's Manual Next: Overview, Previous: ...