hiho week 51 register

Ended

Participants:269

Verdict:Accepted
Score:100 / 100
Submitted:2015-06-27 13:37:48

Lang:G++

Edit
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
#include <stdio.h>
unsigned short  ee[(1 << 15) + 1], m, l;
void dfs(unsigned short s)
{
    unsigned short t = ((s<<1) &l),i=0;
    while(i<2)
    {
        if(ee[(s<<1)+i])
        {
            ee[(s<<1)+i]=0;
            dfs(t+i);
            putchar(i+'0');
        }
        i++;
    }
    return;
}
int main(){
    int N;
    scanf("%d", &N);
    m = 1 << (N - 1);
    l = m-1;
    for (int i = 0; i<m; i++)
    {
        ee[i << 1]++;
        ee[(i << 1) + 1]++;
    }
    dfs(1);
    return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX