modified: 6.cpp
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
// 92
|
||||
#include <cstdio>
|
||||
using namespace std;
|
||||
int c;
|
||||
bool ch[20];
|
||||
int n;
|
||||
void dfs(int now)
|
||||
{
|
||||
if (now == n)
|
||||
if (now > n)
|
||||
{
|
||||
for (int i = 1; i <= n; ++i)
|
||||
{
|
||||
if (c & (1 << i))
|
||||
if (ch[i])
|
||||
printf("%d ", i);
|
||||
}
|
||||
puts("");
|
||||
return;
|
||||
}
|
||||
ch[now]=0;
|
||||
dfs(now + 1);
|
||||
c &= (1 << now);
|
||||
ch[now]=1;
|
||||
dfs(now + 1);
|
||||
}
|
||||
int main()
|
||||
|
||||
Reference in New Issue
Block a user