求组合数,dfs即可

 #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
int N,m,t;
int a[],vis[];
void dfs(int st,int n)
{
int i;
if(n==) //已选择6个
{
int fl=;
for(i=;i<=N;i++)
{
if(vis[i])
{
if(fl) printf("%d",a[i]),fl=;
else printf(" %d",a[i]);
}
}
printf("\n");
return;
}
for(i=st;i<=N;i++)
{
if(!vis[i])
{
vis[i]=;
dfs(i+,n+);
vis[i]=;
}
}
}
int main()
{
int i,j,k=;
//freopen("1.in","r",stdin);
while(scanf("%d",&N)!=EOF&&N>)
{
memset(vis,,sizeof(vis));
if(k++) printf("\n");
for(i=;i<=N;i++) cin>>a[i];
dfs(,);
}
return ;
}

poj 2245 水题的更多相关文章

  1. poj 1269 水题

    题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath ...

  2. poj 1298(水题)

    The Hardest Problem Ever Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24241   Accept ...

  3. poj 3006水题打素数表

    #include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void ispr ...

  4. POJ 3672 水题......

    5分钟写完 水水更开心 //By SiriusRen #include <cstdio> #include <iostream> #include <algorithm& ...

  5. POJ 1488 Tex Quotes --- 水题

    POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...

  6. POJ 水题若干

    POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以 ...

  7. poj 3080 Blue Jeans(水题 暴搜)

    题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...

  8. POJ 水题(刷题)进阶

    转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...

  9. POJ 3984 - 迷宫问题 - [BFS水题]

    题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, ...

随机推荐

  1. 笔记:PHP查询mysql数据后中文字符乱码

    新建表Clubs CREATE TABLE `Clubs` ( `id` ) NOT NULL AUTO_INCREMENT, `name` ) CHARACTER SET utf8 NOT NULL ...

  2. 使用Redis SETNX 命令实现分布式锁

    基于setnx和getset http://blog.csdn.net/lihao21/article/details/49104695 使用Redis的 SETNX 命令可以实现分布式锁,下文介绍其 ...

  3. Ueditor的两种定制方式

    引言 UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码... 官网:http://ueditor ...

  4. VS自带WCF测试客户端简单介绍

    在目前的二次开发项目中,一些信息是放在客户那里的,只给你一个服务地址,不知道具体有什么方法,每次想调用一个服务不知道能不能实现目前的需求,只能测试.写个测试程序真的划不来,占用时间不说,而且你忙了一上 ...

  5. “System.Transactions.Diagnostics.DiagnosticTrace”的类型初始值设定项引发异常[WCF]

    未处理System.TypeInitializationException  HResult=-2146233036  Message=“System.ServiceModel.Diagnostics ...

  6. 将DataTable导出为Excel C#

    /// <summary> /// 导出Excel /// </summary> /// <param name="dt">DataTable& ...

  7. MFC 中控件的启用与禁用

    启用和禁用控件可以调用CWnd::EnableWindow 函数. BOOL EnableWindow(BOOL bEnable = TRUE); 判断控件是否可用可以调用 CWnd::IsWindo ...

  8. 用Lucene检索数据库

    http://blog.sina.com.cn/s/blog_82ac67c101012r9z.html package com.javabean; import java.io.File;impor ...

  9. [POJ1936]All in All

    [POJ1936]All in All 试题描述 You have devised a new encryption technique which encodes a message by inse ...

  10. Controller之间传递数据:协议传值

    http://itjoy.org/?p=416 前边介绍过从第一个页面传递数据到第二个页面,那么反过来呢我们该如何操作?还是同一个例子,将第二个页面的字符串传递到第一个页面显示出来,这中形式就可以使用 ...