/*
    ID:chenjiong
    PROG:subset
    LANG:C++
*/

#include <stdio.h>
#include <string.h>

const int MAXN = 40;

int N;
int set[MAXN];
int sum;
int cnt;

void init()
{
    int i;
    scanf("%d",&N);
    for ( i = 0; i < N; i++)
        set[i] = i + 1;
}

void dfs(int cur)
{
    if ( cur == N )
    {
        if ( sum == N * ( N + 1 ) / 4 )
            cnt++;
        return;
    }
    sum += set[cur];
    dfs(cur + 1);
    sum -= set[cur];

    dfs(cur + 1);
}

int main()
{
    freopen("subset.in","r",stdin);
    freopen("subset.out","w",stdout);

    init();

    if ( ( N * ( N + 1 ) ) % 4 != 0 )
    {
        printf("0\n",cnt);
        return 0;
    }

    dfs(0);

    printf("%d\n",cnt / 2);

    return 0;
}

 

posted on 2012-11-02 22:06  Sinker  阅读(119)  评论(0编辑  收藏  举报