摘要: #include#include#include#include#define MAX 10000000bool b[MAX];void Prime(){ int num = 0, t = sqrt(1.0*MAX); memset(b, true, sizeof(b)); for(int i=2; i < t; i++) { if(b[i]) { for(int j = 2; j * i < MAX; j++) b[j*i]=false; } } for(int... 阅读全文
posted @ 2013-11-24 17:37 偶尔会寂寞 阅读(240) 评论(0) 推荐(1)
摘要: /*最长公共子序列*/#include#include#define max(x, y) a>b?a:b#define For(t, i, j) for(t = i; t = c[i][j-1]) { c[i][j] = c[i-1][j]; b[i][j] = 2;//正上 } else { c[i][j] = c[i][j-1]; b[i][j] = 3;//左 } } cout>x>>y; LCS(); system("pause"); return 0;} 阅读全文
posted @ 2013-11-24 11:37 偶尔会寂寞 阅读(164) 评论(0) 推荐(0)