-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.cpp
More file actions
46 lines (43 loc) · 896 Bytes
/
3.cpp
File metadata and controls
46 lines (43 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*************************************************************************
> File Name: 3.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2016年06月04日 星期六 16时01分24秒
************************************************************************/
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#define LL long long
using namespace std;
const int N = 50086;
bool v[6];
int a[4] = {0};
int n = 3;
void dfs(int cur, int cnt)
{
if(cur == n)
{
for(int i = 0; i < n; i++)
{
printf("%d ", a[i]);
}
printf("\n");
}
for(int i = cnt; i < 5; i++)
{
if(!v[i])
{
v[i] = 1;
a[cur] = i+1;
dfs(cur+1, i+1);
v[i] = 0;
}
}
}
int main()
{
dfs(0, 0);
return 0;
}