uva 441 Lotto
来源:互联网 发布:尚硅谷javascript视频 编辑:程序博客网 时间:2024/06/05 10:55
题目:输入一个n,然后输入n个数字(递增且n>6),然后取其中的6个数字
方法:看到同学的方法才明白了可以用暴力求解,虽然循环比较多,但是好理解
注意:空行
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cctype> #include<algorithm> using namespace std;int main(int argc, char *argv[]) {int num[100],a,b,c,d,e,f,n;int flag=0;//用来控制行之间回车while (cin >> n) {if(flag!=0 && n!=0) cout<<endl;if(n==0)break;for(int i = 0; i < n; i++) cin >> num[i];for(a = 0; a < n-5; a++){for(b = a+1; b < n-4; b++){for(c = b+1; c < n-3; c++){for(d = c+1; d < n-2; d++){for(e = d+1; e < n-1; e++){for(f = e+1; f < n; f++){cout << num[a]<<" " << num[b]<<" " << num[c]<<" " << num[d]<<" " << num[e]<<" " << num[f] << endl;}}}}}}flag++;//cout<<endl;}return 0;}
0 0
- UVa 441 - Lotto
- 【UVa】441 - Lotto
- uva 441 Lotto
- 使用STL输出组合序列 + UVa 441 Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- Lotto
- zoj1089 Lotto
- 1089(LOTTO)
- 1089 Lotto
- nkoj1038: Lotto
- 一些常用的linux命令
- Sudoku
- 2017河南工业大学校赛 D rqy的键盘
- NCS8801S规格书RGB/LVDS转EDP
- 查找表【严蔚敏】
- uva 441 Lotto
- linux中自建证书搭建https
- hdu 1561 The more, The Better(树形dp)
- LinkedHashMap和HashMap的比较使用
- AngularJS入门 、AngularJS控制器 、AngularJS常见的内置指令
- angular--$watch监视用法
- org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: u near line 1, column 55 [fro
- angular入门
- Redis系列(三)——主从介绍和配置