[Swust OJ 234]--IrreducibleNumber(题意太坑)
题目链接:http://acm.swust.edu.cn/problem/0234/
a sum of one or more elements from the numbers, where each element of the numbers may be used at most once. Return
the smallest positive integer that is irreducible with respect to the given numbers.
next line contains n numbers (1 =< number <= 100)
|
2
1 1
2
1 2
-1
|
|
3
4
|
#include <iostream>
using namespace std;
int a[], vis[];
int main(){
int n, i;
while (cin >> n, n != -){
memset(vis, , sizeof(vis));
for (i = ; i <= n; i++){
cin >> a[i];
vis[a[i]] = ;
}
if (n == ){
vis[a[] + a[]] = ;
}
else{
vis[a[] + a[]] = ;
vis[a[] + a[]] = ;
vis[a[] + a[]] = ;
vis[a[] + a[] + a[]] = ;
}
for (i = ;; i++)
if (!vis[i]) {
cout << i << endl;
break;
}
}
return ;
}
其实多简单的,就是题意太坑了有木有~~~
[Swust OJ 234]--IrreducibleNumber(题意太坑)的更多相关文章
- [Swust OJ 649]--NBA Finals(dp,后台略(hen)坑)
题目链接:http://acm.swust.edu.cn/problem/649/ Time limit(ms): 1000 Memory limit(kb): 65535 Consider two ...
- SWUST OJ NBA Finals(0649)
NBA Finals(0649) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 404 Accepted: 128 Descri ...
- js 赋值 要用 toString() ; 太坑了。
js 赋值 要用 toString() ; 太坑了. js 赋值 要用 toString() ; 太坑了. js 赋值 要用 toString() ; 太坑了.
- [Swust OJ 404]--最小代价树(动态规划)
题目链接:http://acm.swust.edu.cn/problem/code/745255/ Time limit(ms): 1000 Memory limit(kb): 65535 Des ...
- 太坑了,mybatis注解一对多,id没了
@Select("SELECT *, id nodes FROM QUESTION_PO WHERE ID=#{id}") @Results({ @Result(property ...
- [Swust OJ 188]--异面空间(读懂题意很重要)
题目链接:http://acm.swust.edu.cn/problem/188/ Time limit(ms): 1000 Memory limit(kb): 65535 江鸟来到了一个很奇怪的 ...
- [Swust OJ 1125]--又见GCD(数论,素数表存贮因子)
题目链接:http://acm.swust.edu.cn/problem/1125/ Time limit(ms): 1000 Memory limit(kb): 65535 Descriptio ...
- [Swust OJ 1126]--神奇的矩阵(BFS,预处理,打表)
题目链接:http://acm.swust.edu.cn/problem/1126/ Time limit(ms): 1000 Memory limit(kb): 65535 上一周里,患有XX症的哈 ...
- [Swust OJ 893]--Blocks
题目链接:http://acm.swust.edu.cn/problem/893/ Time limit(ms): 1000 Memory limit(kb): 65535 Josh loves ...
随机推荐
- Hibernate学习之hql查询语句
* 页面上数据的字段和数据库中字段差不多,这个时候,采用迫切连接 结构比较好,如果页面上的字段很少,要按照需求加载数据,采用带构造函数的select查询 实例讲解:转自:http://www.cn ...
- SqlHelp
using System.Configuration;using System.Data; public class SqlHelp { private static string connectio ...
- Oracle "Job定时"
今天需要做个定时器,定时到别的库导入数据用到了Job,第一次使用记录下来,如果有第一次操作的可以借鉴一下 1.首先,使用Toad新建job,进入配置页面
- poj 1041 John's trip 欧拉回路
题目链接 求给出的图是否存在欧拉回路并输出路径, 从1这个点开始, 输出时按边的升序输出. 将每个点的边排序一下就可以. #include <iostream> #include < ...
- Python学习笔记 (2) :字符串输出、操作、格式化和日期、时间格式化
一.字符串输出及运算 1.常用输出格式及方法 ')#单引号 ")#双引号 """)#三个引号 1234567890 1234567890 1234567890 ...
- Docker背后的容器管理——Libcontainer深度解析
Libcontainer 是Docker中用于容器管理的包,它基于Go语言实现,通过管理namespaces.cgroups.capabilities以及文件系统来进行容器控制.你可以使用Libcon ...
- Vistual Studio 2010 调试无法进断点
系统是2003出现的问题 win8就没事 打sp1 补丁就行
- TexturePacker
TexturePacker 可以免费申请,希望可以申请到.
- Spring Boot Admin Reference Guide
1. What is Spring Boot Admin? Spring Boot Admin is a simple application to manage and monitor your S ...
- ubuntu中彻底删除nginx
1.先执行一下命令: 1.1 删除nginx,–purge包括配置文件 sudo apt-get --purge remove nginx 1.2 自动移除全部不使用的软件包 sudo apt-get ...