zoj 1089 || poj 2245 Lotto(DFS~)
2010-10-17 18:38
417 查看
好吧 这题搜的DFS。。。自己写的,自己想的总是有错,改了好多好多都不对。。。哭啊。。。对DFS还是理解不透。。。
呜呜。。。交poj的时候,看讨论版 好多神奇的方法。。。6层循环 我晕。。。确实可以。。。。我了个去。。
呜呜。。。交poj的时候,看讨论版 好多神奇的方法。。。6层循环 我晕。。。确实可以。。。。我了个去。。
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <memory.h> using namespace std; int n,num[14],put[14]; void DFS(int d,int current) { if( d > 6 ) { for(int j=1; j<=5; j++) cout << put[j] << ' '; cout << put[6] << endl; } else for(int i=current; i<n-(6-d)+1; i++) { put[d] = num[i]; DFS( d+1, i+1 ); } } int main(void) { int flag = 1 ; while( cin >> n && n) { if( flag == 0 ) cout << endl; for(int i=1; i<=n; i++) { cin >> num[i]; } DFS(1,1); flag = 0; } return 0; }
相关文章推荐
- poj 2245lotto(dfs)
- POJ 2245 Lotto dfs
- POJ 2245 Lotto DFS
- poj 2245 Lotto dfs
- POJ 2245 Lotto DFS
- hdu 1342&&poj 2245&&zoj 1089 Lotto
- zoj 1089 lotto (DFS )
- POJ 2245 Lotto-DFS-(回溯法)
- POJ 2245 Lotto(水水的dfs)
- POJ 题目2245 Lotto(DFS水)
- Lotto zoj 1089
- zoj 2165||poj 1979 red and black (dfs)
- JOJ 1089 & ZOJ 1060 & poj 1094 Sorting It All Out (邻接表的栈拓扑排序模板)
- ACM POJ 2245Lotto解题报告
- zoj 1709 || poj 1562 Oil Deposits(DFS 好吧,目前我就是专门找水题做的。。。)
- ZOJ 1089--DFS--组合
- poj 2245Lotto
- POJ 2245 Lotto 笔记
- ZOJ 1089-Lotto
- POJ 1562 && ZOJ 1709 Oil Deposits(简单DFS)