首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

搜寻:zoj 1089 || poj 2245 Lotto(DFS)

2012-10-24 
搜索:zoj 1089 || poj 2245 Lotto(DFS)【转】http://blog.csdn.net/zxy_snow/article/details/5947090#inclu

搜索:zoj 1089 || poj 2245 Lotto(DFS)

【转】http://blog.csdn.net/zxy_snow/article/details/5947090

#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;}elsefor(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;}

?

热点排行