Lotto

Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 47   Accepted Submission(s) : 14
Problem Description
In a Lotto I have ever played, one has to select 6 numbers from the set {1,2,...,49}. A popular strategy to play Lotto - although it doesn't increase your chance of winning - is to select a subset S containing k (k>6) of these 49 numbers, and then play several games with choosing numbers only from S. For example, for k=8 and S = {1,2,3,5,8,13,21,34} there are 28 possible games: [1,2,3,5,8,13], [1,2,3,5,8,21], [1,2,3,5,8,34], [1,2,3,5,13,21], ... [3,5,8,13,21,34]. 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
The input file will contain one or more test cases. Each test case consists of one line containing several integers separated from each other by spaces. The first integer on the line will be the number k (6 < k < 13). Then k integers, specifying the set S, will follow in ascending order. Input will be terminated by a value of zero (0) for k.
 
Output
For each test case, print all possible games, each game on one line. The numbers of each game have to be sorted in ascending order and separated from each other by exactly one space. The games themselves have to be sorted lexicographically, that means sorted by the lowest number first, then by the second lowest and so on, as demonstrated in the sample output below. The test cases have to be separated from each other by exactly one blank line. Do not put a blank line after the last test case.
 
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 <stdio.h>
#include <stdlib.h> int main()
{
int Len,i,sign,a,b,c,d,e,f;
scanf("%d",&Len);
while()
{
int num[]={};
if(Len==)break;
for(i=;i<Len;i++)
scanf("%d",&num[i]);
for(a=;a<Len;a++)
{
for(b=a+;b<Len;b++)
{
for(c=b+;c<Len;c++)
{
for(d=c+;d<Len;d++)
{
for(e=d+;e<Len;e++)
{
for(f=e+;f<Len;f++)
{
printf("%d %d %d %d %d %d\n",num[a],num[b],num[c],num[d],num[e],num[f]);
}
}
}
}
}
}
scanf("%d",&Len);
if(Len==)break;
else printf("\n");
}
return ;
}

Lotto的更多相关文章

  1. poj 2245 Lotto

    Lotto Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6806   Accepted: 4298 Description ...

  2. ZOJ 1089 Lotto

    原题链接 题目大意:有一种抽奖游戏乐透(Lotto),规则是从1到49这49个自然数中随机抽取6个数.现在有一种简化版的游戏,先在49个数里面选出k(6<k<13)个数,然后再从这k个数里 ...

  3. hdoj 1342 Lotto【dfs】

    Lotto Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  4. Lotto(dfs)

    Lotto Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submis ...

  5. HDU1342 Lotto 【深搜】

    Lotto Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

  6. 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 ...

  7. 隐马尔科夫模型研究 stock 以及 lotto

    说明 本文参考了这里 由于数据是连续的,因此使用了高斯隐马尔科夫模型:gaussianHMM 一.stock代码 import tushare as ts import pandas as pd im ...

  8. 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 ...

  9. Hdu1342 Lotto 2017-01-18 17:12 44人阅读 评论(0) 收藏

    Lotto Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submiss ...

随机推荐

  1. poj 1308Bugs Integrated, Inc. [三进制状压]

    题目链接[http://poj.org/problem?id=1038] 题意: 给出一个N*M大小的图,图中有K个坏点.N (1 <= N <= 150), M (1 <= M & ...

  2. IE8及以下不支持getElementByClassName的解决办法

    function getByClass(oParent, sClass){ var aEle=oParent.getElementsByTagName('*'); var aResult=[]; va ...

  3. php之soap使用

    1,首先要在linux服务器安装php的soap拓展,最快的方式是yum安装: #yum install php-soap 然后重启apache即可 2,php调用soap接口 try{ $soap ...

  4. 【第一篇】Volley的使用之json请求

    最近项目写完,有开始新的学习了,volley很久以前就接触了,也看了源码,然而却没有通过文章去记录自己的学习成果. 首先讲下volley的特点: 1,扩展性强.Volley 中大多是基于接口的设计,可 ...

  5. mac 电脑配置cordova

    最近发现这个cordova有很多公司在用.所以想试试搭建一个ios平台上的cordova demo.在搭建之前我先说一些跟cordova相关的一些条件. 目前cordova项目在apache上开源.网 ...

  6. webstorm常用快捷键及(idea,phpstorm,android studio通用)使用技巧

    webstorm常用快捷键 ctrl+l 格式化代码 ctrl+shift+ -/+键   折叠/展开所有代码 打开file:ctrl+shift+n 打开一个类:ctrl+n 代码提示:Ctrl+a ...

  7. javascript 限制字符串字数换行 带BUG

    function chang(str ,len) { function lenStat(str) { function isChinese(str) { //判断是不是中文 var reCh = /[ ...

  8. php和js的转成整数的方法

    1.将变量转成整数类型php: intval(7/2)js:parseInt(7/2)2.向上取整,有小数就整数部分加1php: ceil(7/2)js: Math.ceil(7/2)3,四舍五入.p ...

  9. JSP+Servlet实现上传下载

    0.项目结构 1.在WebRoot下创建index.jsp页面 <%@ page language="java" import="java.util.*" ...

  10. Struts对输入数据的校验

    当我们在登录或者是注册时需要对用户输入的数据验证,以前都是浏览器传送数据到后台,后台对数据进行校验,如果有错误就带着错误信息转发带登录或者注册页面, struts可以简便的对输入数据进行校验 首先我们 ...