摘要:
/* 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 * (... 阅读全文
摘要:
/* ID:chenjiong PROG:subset LANG:C++*/#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;const int MAXN = 40;int N;int set[MAXN];int use[MAXN];int sum_a,sum_b;int cnt_a,cnt_b;int cnt;int sum;void init(){ int i; scanf("%d",&N); for ( i = 0; i 阅读全文
摘要:
因为要求最终序列化为2^B进制数后最小,所以最小从0开始一一枚举&检验即可。/* ID:chenjiong PROG:hamming LANG:C++*/#include <stdio.h>#include <string.h>int N,B,D;int ans[64][9]; int num;int limit[9] = {0,1,3,7,15,31,63,127,255};int cnt;void binary(int x,int* tmp){ tmp[cnt++] = x % 2; if ( x > 0 ) binary( x / 2... 阅读全文