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 ...
随机推荐
- CentOS6.4x64安装mysql5.6.23(rpm)
#查看已安装的的mysql shell>rpm -qa|grep -i mysql #根据上条命令的结果卸载mysql shell>rpm -e -nodeps mysql* #下载mys ...
- Effective Java单元测试TestNG - 就是爱Java
TestNG是另一种单元测试的framework,与JUnit的类似,这次Mix将使用它来撰写测试程序,大部分所引用的class package都一样,只差在JUnit与TestNG的字样,可以直接用 ...
- 2015第10周五CSS—2
经常遇到的浏览器兼容性有哪些?如何解决? 1.浏览器默认的margin和padding不同.解决方案是加一个全局的*{margin:0;padding:0;}来统一. 2.IE6双边距bug:块属性标 ...
- swing的第一课
Swing介绍 Swing API 可扩展 GUI组件,以减轻开发者的生活创造基于JAVA前端/GUI应用.它是建立在AWT API之上,并作为 AWTAPI 的更换,因为它几乎每一个控制对应 AWT ...
- Jquery之家5个顶级Material Design框架
谷歌Material Design在如今的前端页面设计中非常流行.Material Design的设计风格向我们展示了一个简单而有内涵的现代UI设计方案. Material Design是如此的简洁美 ...
- UESTC_邱老师选妹子(二) 2015 UESTC Training for Dynamic Programming<Problem I>
I - 邱老师选妹子(二) Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Su ...
- OpenWrt for vmware 从openwrt.org下载10.03.1 或是自己下载最新的源码进行编译生成x86 vmdk格式
1,直接从OpenWrt.org官网下载 http://downloads.openwrt.org/backfire/10.03.1/x86_generic/ 更新OpenWrt在线软件源 opkg ...
- linux 安装gcc和g++
linux中安装gcc和g++ 今天在linux的服务器上安装C/C++的编译器gcc和g++,运行了如下两条命令: 1 yum install gcc yum install g++ 然后发现gcc ...
- JavaScript-打开新窗口
open()方法可以查找一个已经存在或者新建一个新的浏览器窗口. 语法:window.open([URL], [窗口名称], [参数字符串]) 参数解释: URL:可选参数,在窗口中显示网页的网址或路 ...
- 解决红米等手机(移动端)无法触发touchend事件
触屏事件的简单描述: js的触屏事件,主要有三个事件:touchstart,touchmove,touchend. 这三个事件最重要的属性是 pageX和 pageY,表示X坐标,Y坐标.touchs ...