BestCoder Round #80(A)模拟
来源:互联网 发布:苹果电脑清理垃圾软件 编辑:程序博客网 时间:2024/04/29 01:39
Lucky
Accepts: 819
Submissions: 2299
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)
问题描述
Vampire喜欢玄学,尤其喜欢研究幸运数字. 对于一个数字集合S,定义关于S的幸运数字为无法用S中的数相加得到的最小的非负整数(每个数可以使用任意次). 现在给定一个数集,如果能使用其中的数相加得到任意自然数,输出”YES”,否则输出”NO”.
输入描述
第一行一个正整数T,为数据组数. 每组数据第一行一个n,表示集合大小. 接下来n个数,表示该数集里的数. 1≤n≤105,1≤T≤10,0≤ai≤109.
输出描述
每组数据回答一个”YES”或”NO”.
输入样例
112
输出样例
NO
题解:只要判断有没有1和0
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<string> #include<bitset> #include<utility> #include<functional> #include<iomanip> #include<sstream> #include<ctime> using namespace std;#define N int(1e5) #define inf int(0x3f3f3f3f) #define mod int(1e9+7) typedef long long LL;set<int>v;int main(){#ifdef CDZSC freopen("i.txt", "r", stdin); //freopen("o.txt","w",stdout); int _time_jc = clock();#endif int n,t,x; scanf("%d", &t); while (t--) { v.clear(); scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d", &x); v.insert(x); } if (v.count(1) && v.count(0)) { puts("YES"); } else puts("NO"); } return 0;}
0 0
- BestCoder Round #80(A)模拟
- BestCoder Round #80A
- Missing number (BestCoder Round #28A )
- BestCoder Round #41 -- (A,B)
- BestCoder Round #70(A)数学
- BestCoder Round #77 (div.2)(A)
- BestCoder Round #19 A
- BestCoder Round #20 A
- BestCoder Round #21 A
- BestCoder Round #22 A
- BestCoder Round #23 A
- BestCoder Round #75 1001模拟
- BestCoder Round #75 1002模拟
- BestCoder Round #58 LCS 即hdu5495 (模拟)
- BestCoder Round #60 GT and numbers (模拟)
- BestCoder Round #62 (div.2)-Clarke and food(模拟)
- BestCoder Round #75-King's Cake(模拟)
- BestCoder Round #76 (div.2)-DZY Loves Partition(模拟)
- 给定一个正整数x,找到一个最小的正整数y,使得y的每一位相乘,最后值等于x
- erlang 创建一个进程所占的内存
- BestCoder Round #80 Segment
- String深拷贝+String增删改查
- struts2中配置拦截器、拦截器栈和默认拦截器
- BestCoder Round #80(A)模拟
- java虚拟机Class类文件的结构
- Android Studio实现代码混淆
- php中需要注意的问题
- 字母A-Z的快速定位滑块的学习研究
- 设计模式-可复用面向对象软件的基础 [读书笔记]
- web.xml详解
- java.sql.SQLException: Value'0000-00-00'错误解决方法
- BestCoder Round #80(B)高精度