POJ2245 Lotto
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 6634 | Accepted: 4201 |
Description
Your job is to write a program that reads in the number k and the set S and then prints all possible games choosing numbers only from S.
Input
Output
Sample Input
7 1 2 3 4 5 6 7
8 1 2 3 5 8 13 21 34
0
Sample Output
1 2 3 4 5 6
1 2 3 4 5 7
1 2 3 4 6 7
1 2 3 5 6 7
1 2 4 5 6 7
1 3 4 5 6 7
2 3 4 5 6 7 1 2 3 5 8 13
1 2 3 5 8 21
1 2 3 5 8 34
1 2 3 5 13 21
1 2 3 5 13 34
1 2 3 5 21 34
1 2 3 8 13 21
1 2 3 8 13 34
1 2 3 8 21 34
1 2 3 13 21 34
1 2 5 8 13 21
1 2 5 8 13 34
1 2 5 8 21 34
1 2 5 13 21 34
1 2 8 13 21 34
1 3 5 8 13 21
1 3 5 8 13 34
1 3 5 8 21 34
1 3 5 13 21 34
1 3 8 13 21 34
1 5 8 13 21 34
2 3 5 8 13 21
2 3 5 8 13 34
2 3 5 8 21 34
2 3 5 13 21 34
2 3 8 13 21 34
2 5 8 13 21 34
3 5 8 13 21 34
Source
/*
ID: LinKArftc
PROG: poj2245.cpp
LANG: C++
*/ #include <map>
#include <set>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define eps 1e-8
#define randin srand((unsigned int)time(NULL))
#define input freopen("input.txt","r",stdin)
#define debug(s) cout << "s = " << s << endl;
#define outstars cout << "*************" << endl;
const double PI = acos(-1.0);
const int inf = 0x3f3f3f3f;
const int INF = 0x7fffffff;
typedef long long ll; const int maxn = ; int num[maxn];
int n;
int ans[]; void dfs(int cnt, int cur) {
if (cnt == ) {
for (int i = ; i <= ; i ++) printf("%d%c", ans[i], i == ? '\n' : ' ');
return ;
}
if (cur > n) return;
for (int i = cur; i <= n; i ++) {
cnt ++;
ans[cnt] = num[i];
dfs(cnt, i + );
cnt --;
}
} int main() { int _t = ;
while (~scanf("%d", &n) && n) {
if (_t > ) printf("\n");
_t ++;
for (int i = ; i <= n; i ++) scanf("%d", &num[i]);
dfs(, );
} return ;
}
POJ2245 Lotto的更多相关文章
- poj 2245 Lotto
Lotto Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6806 Accepted: 4298 Description ...
- ZOJ 1089 Lotto
原题链接 题目大意:有一种抽奖游戏乐透(Lotto),规则是从1到49这49个自然数中随机抽取6个数.现在有一种简化版的游戏,先在49个数里面选出k(6<k<13)个数,然后再从这k个数里 ...
- hdoj 1342 Lotto【dfs】
Lotto Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- Lotto(dfs)
Lotto Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) Total Submis ...
- HDU1342 Lotto 【深搜】
Lotto Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- Lotto
Lotto Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submiss ...
- ZOJ2402 Lenny's Lucky Lotto List 简单DP
Lenny's Lucky Lotto Lists Time Limit: 2 Seconds Memory Limit:65536 KB Lenny likes to play the g ...
- 隐马尔科夫模型研究 stock 以及 lotto
说明 本文参考了这里 由于数据是连续的,因此使用了高斯隐马尔科夫模型:gaussianHMM 一.stock代码 import tushare as ts import pandas as pd im ...
- ZOJ2402 Lenny's Lucky Lotto List 简单DP
Lenny's Lucky Lotto Lists Time Limit: 2 Seconds Memory Limit:65536 KB Lenny likes to play the g ...
随机推荐
- 自动化测试--testNG
该文章主要介绍 testNG(testing next generation,下一代测试技术)框架的使用. 1.首先安装testNG 2.安装完成后,创建maven项目,导入TESTNG和seleni ...
- beanshell引用参数化数据
步骤: 1.添加参数化组件CSV Data Set Config: 2.添加beanshell preprocessor,引用变量: 验证: 2个线程,迭代2次,分别取了4个不同的值.
- coreos install hpssacli
基于官方的coreos ramdisk安装hp raid管理工具,其版本为debian8 apt-get install curl nano /etc/apt/sources.list deb htt ...
- 寻找完全数(C++)
[问题描述] 输入一个大于 1 的正整数 n,请你将大于 1 和小于或等于 n 的所有完全数输出.所谓完全数就是因子(不算其本身)之和等于它本身的数.例如 1+2+4+7+14=28,所以 28 是完 ...
- redis的认识
<?php /* Redis优势: 性能极高 – Redis能读的速度是110000次/s,写的速度是81000次/s . 丰富的数据类型 – Redis支持二进制案例的 String, Lis ...
- 微信公众号开发java框架:wx4j(MaterialUtils篇)
wx4j-MaterialUtils的使用 函数说明:上传永久视频素材 参数:文件路径.视频描述(通过setter填充内容即可) 返回值:微信服务器返回的json字符串 public static S ...
- StanFord 编程方法
教程下载地址:http://www.yyets.com/resource/26208 定制工具下载地址:http://www.stanford.edu/class/cs106a/cgi-bin/cla ...
- vue2.0介绍
1.vue.js 是什么 vue(view)是一套构建用户界面的渐进式框架 Vue (pronounced /vjuː/, like view) is a progressive framework ...
- capacilitys 持续集成
目前看好像是说以docker为例来看看这个权限到底是怎么来的? 可以通过在二进制上setcap得到,也可以通过函数自己用setcap得到,两种方法,docker肯定是第二种方法啊,docker中间肯定 ...
- JavaScript中的String对象详解
1.属性 String对象最常用的属性是length,用于返回字符串对象的长度. 2.方法 CharAt(index) 返回字符串对象中指定索引号组成的字符串,位置的有效值为0到字符串的长度减1. ...