Lotto--poj2245
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 6605 | Accepted: 4185 |
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
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[],b[],n; void dfs(int num,int p)
{
int i;
if(p>n)
return ;
if(num>=)
{
for(i=;i<;i++)
printf("%d ",b[i]);
printf("%d\n",b[]);
return ;
}
b[num]=a[p];
dfs(num+,p+);
dfs(num,p+);
return;
}
int main()
{
int i,flag=;
while(scanf("%d",&n),n)
{
if(flag)
printf("\n");
flag=;
for(i=;i<n;i++)
scanf("%d",&a[i]); dfs(,);
} }
Lotto--poj2245的更多相关文章
- POJ2245 Lotto
Lotto Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6634 Accepted: 4201 Description ...
- 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 ...
随机推荐
- 正确看待HTML5的语法变化
也许会有人问:“HTML4已经很普及了,如果改变基础语法,会不会有什么影响?” 我们都知道,在HMTL5之前几乎没有符合标准规范的Webu浏览器!在这种情况下,各个浏览器之间的互相兼容性和互操作性在很 ...
- vs2003的代码考到vs2010 会出现(Windows CR LF)
拷贝到VS中,出现各种莫名其妙的编译错误,这个时候需要注意,造成这种情况的原因可能在于,你所拷贝的源代码在换行时并非采用Windows系统的CR LF方式. 下面给出一个简单的方法来将不合要求的文本更 ...
- opencv for python
opencv显示图像: # -*- coding: UTF-8 -*- import numpy as np import cv2 from matplotlib import pyplot as p ...
- 软件体系结构经典问题——KWIC的分析和解决
KWIC作为一个早年间在ACM的Paper提出的一个问题,被全世界各个大学的软件设计课程奉为课堂讲义或者作业的经典.(From Wiki,FYI,D. L. Parnas uses a KWIC In ...
- css案例学习之按钮超链接
效果 css实现 <html> <head> <title>按钮超链接</title> <style> a{ /* 统一设置所有样式 */ ...
- DDMS files not found:hprof-conv.exe的解决办法
或者是you must restart adb and eclipse这类错误 原因:一般是豌豆荚之类的软件影响的,所以,以后要慎用了. 解决方案:先找一下在sdk\tools目录下是否有hprof- ...
- 经过一年时间的沉淀 再次回首 TCP Socket服务器编程--转
------------------ 前言 ------------------ 开发了这么多年,发现最困难的程序开发就是通讯系统. 其他大部分系统,例如CRM/CMS/权限框架/MIS之类的,无论怎 ...
- bzoj1649 [Usaco2006 Dec]Cow Roller Coaster
Description The cows are building a roller coaster! They want your help to design as fun a roller co ...
- openssl CA 自签证书,阿里云配置tomcat https
<一,openssl CA自签发证书> 1,生成私钥 openssl genrsa 1024 > private.key;
- JOB+MERGE 跨服务器同步数据
为了解决单服务器压力,将库分服务器部署,但是原来用触发器实现的表数据同步就实现不了了. 因为总监老大不允许 开启分布式事务(MSDTC),我又不想为了一个几千行的基础数据做复制订阅. 于是乎决定用 J ...