hdoj 5665 Lucky 【水题】
来源:互联网 发布:linux 黑客工具 编辑:程序博客网 时间:2024/06/06 00:56
题目链接:hdoj 5665 Lucky
Lucky
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 465 Accepted Submission(s): 282
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≤105,1≤T≤10,0≤ai≤109.
Output
Output“YES”or “NO”to every query.
Sample Input
1
1
2
Sample Output
NO
题意:给定一个集合,你可以使用任意一个元素多次。问你该集合能否得到所有的非负数。
特判0和1即可。
#include <cstdio>#include <cstring>#include <algorithm>#include <map>#include <iostream>#include <cmath>#include <queue>#include <stack>#define ll o<<1#define rr o<<1|1#define CLR(a, b) memset(a, (b), sizeof(a))using namespace std;typedef long long LL;typedef pair<int, int> pii;const int INF = 0x3f3f3f3f;const int MAXN = 1e5 + 10;int a[MAXN];int main(){ int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); bool flag = false; bool zero = false; for(int i = 0; i < n; i++) { scanf("%d", &a[i]); if(a[i] == 1) { flag = true; } if(a[i] == 0) { zero = true; } } printf(flag&&zero ? "YES\n" : "NO\n"); } return 0;}
0 0
- hdoj 5665 Lucky 【水题】
- hdoj 5665 Lucky 【水】
- hdu 5665 Lucky【水题】
- HDOJ 4937 Lucky Number
- HDOJ 4937 Lucky Number
- 【分块】 HDOJ 5213 Lucky
- HDOJ 5213 Lucky
- hdoj 4937 Lucky Number【想法】
- hdoj 1687 Lucky Light 【区间找点】
- hdoj 4937 Lucky Number 【思维题】
- hdoj 5676 ztr loves lucky numbers 【二分】
- HDU 5665 Lucky
- hdu--5665--Lucky
- HDU 5665 Lucky
- 【杭电】[5665]Lucky
- HDU 5665:Lucky【水】
- 杭电5665 Lucky
- HDU 5665 lucky
- There are inconsistent line endings in the "XXX.cs" script
- Class.isAssignableFrom()和instanceOf关键字
- [x-Code7新功能之四]Core Location和MapKit框架练习
- 刷新例子
- TransR/CTransR论文剩余部分:元组分类,文本关系抽取,结论
- hdoj 5665 Lucky 【水题】
- Python Paste Deployment
- 数据结构—排序
- blog 迁移
- JAVA--浅谈线程
- Maven教程:Maven Pom.xml文件详细解释
- Android 处理窗口控件大小,形状,像素等工具
- iOS开发-- 创建podspec文件,为自己的项目添加pod支持
- hdu 1875