摘要: /* 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 阅读全文
posted @ 2012-11-02 21:23 Sinker 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 因为要求最终序列化为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... 阅读全文
posted @ 2012-11-02 12:57 Sinker 阅读(153) 评论(0) 推荐(0) 编辑
摘要: /* ID:chenjiong PROG:sort3 LANG:C++*/#include <stdio.h>#include <string.h>const int MAXN = 1005;int N;int a[MAXN];int p1,p2,p3;int cnt;void swap(int& a,int& b){ a = a + b; b = a - b; a = a - b;}void init(){ scanf("%d",&N); p1 = p2 = p3 = cnt = 0; int i; for ( i = 0; 阅读全文
posted @ 2012-10-30 14:29 Sinker 阅读(139) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>const int MAXN = 10000;int N;int a[MAXN];int K;int partition(int l,int r){ int key = a[l]; while ( l < r ) { while ( l < r && a[r] >= key ) r--; a[l] = a[r]; while ( l < r && 阅读全文
posted @ 2012-10-30 13:44 Sinker 阅读(188) 评论(0) 推荐(0) 编辑
摘要: /* ID:chenjiong PROG:holstein LANG:C++*/#include <stdio.h>#include <string.h>int V;int vitamin[30];int G;int feed[20][30];int idx[20];int limit[20];int R; bool flag = false;bool is_ok(){ int i,j; for ( i = 0; i < V; i++) { int sum = 0; for ( j = 0; j < R; j++) ... 阅读全文
posted @ 2012-10-29 14:10 Sinker 阅读(173) 评论(0) 推荐(0) 编辑
摘要: A team of researchers from MIT, Caltech, Harvard, and other universities in Europe, have devised a way of boosting the performance of wireless networks by up to 10 times — without increasing transmission power, adding more base stations, or using more wireless spectrum. This is expected to have huge 阅读全文
posted @ 2012-10-28 16:38 Sinker 阅读(220) 评论(0) 推荐(0) 编辑
摘要: /* ID:chenjiong PROG:frac1 LANG:C++*/#include <stdio.h>#include <string.h>const int MAXN = 160;typedef struct { int x; int y;}FRAC;int N;FRAC table[MAXN * MAXN / 2];int cnt;int gcd(int a,int b){ // a >= b if ( b == 0 ) return a; else return gcd(b,a % b);}void ge... 阅读全文
posted @ 2012-10-28 14:18 Sinker 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 在移除房间北墙的时候忘了移除该房间北邻的南墙,wa了一次,注意移墙时的搜索顺序:自底向上,自左向右。/* ID:chenjiong PROG:castle LANG:C++*/#include <stdio.h>#include <string.h>const int MAXN = 55;typedef struct { int dir[4][3]; //西北东南}POS;typedef struct { int x; int y; char d; int size;}WALL;int M,N;POS map[MAXN][MAXN];bo... 阅读全文
posted @ 2012-10-27 22:54 Sinker 阅读(156) 评论(0) 推荐(0) 编辑
摘要: /* ID:chenjiong PROG:checker LANG:C++*/#include <stdio.h>#include <string.h>const int MAXN = 15;int N;bool column[MAXN];bool diagonal1[2 * MAXN - 1];bool diagonal2[2 * MAXN - 1];int ans[MAXN];int p;int cnt;int print_times;void dfs(int cur){ if ( cur == N + 1 ) { if ( print_time... 阅读全文
posted @ 2012-10-27 00:51 Sinker 阅读(177) 评论(0) 推荐(0) 编辑
摘要: /* ID:chenjiong PROG:sprime LANG:C++*/#include <stdio.h>#include <string.h>#include <math.h>int N;int ans;bool is_prime(int x){ if ( x == 1 ) return false; if ( x == 2 || x == 3 ) return true; if ( x % 2 == 0 ) return false; int i; for ( i = 3; i <= sqrt(... 阅读全文
posted @ 2012-10-26 23:42 Sinker 阅读(152) 评论(0) 推荐(0) 编辑