上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 182 下一页
摘要: dp,类似最长公共子序列View Code #include <iostream>#include <cstring>#include <cstdio>#include <cstdlib>using namespace std;#define maxl 105char name[6] = "ACGT-";char gene1[maxl], gene2[maxl];int len1, len2;int match[5][5] ={{ 5, -1, -2, -1, -3 },{ -1, 5, -3, -2, -4 },{ -2, 阅读全文
posted @ 2012-12-28 19:59 undefined2024 阅读(531) 评论(0) 推荐(0)
摘要: 题意:有一些木棍,每个有长度和重量,要求把这些木棍排成若干两个属性值均不下降的序列。问至少要分为多少个序列。分析:如果木棍a可以接在木棍b的前面(a的两个属性值均不大于b),那么我们由a向b连一条边。但如果存在a->b,b->c,则我们不连接a,c。这样我们就得到了一个图,根据建图方法可知这个图一定是无环的。现在我们把问题转化为求这个图的最小路径覆盖。但是由于它是无环的当我们走到一个岔口,无论选择那条路都无所谓,因为剩下的一条路早晚要走,现在走和以后走都一样。我们只需要保证我们所构成的任何一个序列的中间不能插入木棍即可。具体做法是将所有木棍排序,先按一个属性,一个属性相等的按第二个 阅读全文
posted @ 2012-12-27 11:27 undefined2024 阅读(1507) 评论(0) 推荐(1)
摘要: 简单模拟View Code #include <iostream>using namespace std;const int maxn=22;int n,N,p[maxn],le[maxn];bool first;void init(){ int i,j; cin>>n; first=true; for (i=1;i<=n;i++) { cin>>p[i]; le[i]=p[i]-p[i-1]; j=i; while (!le[j]) ... 阅读全文
posted @ 2012-12-25 16:02 undefined2024 阅读(433) 评论(0) 推荐(0)
摘要: 简单模拟View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxl 75int key;char cipher_text[maxl];char plain_text[maxl];bool is_letter(char ch){ return ch <= 'z' && ch >= 'a';}int get_code(cha 阅读全文
posted @ 2012-12-24 13:50 undefined2024 阅读(144) 评论(0) 推荐(0)
摘要: bfsView Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 105struct Node{ int va, vb, step, pre, opr;} q[maxn * maxn];int a, b, c, l, r;bool vis[maxn][maxn];int stk[maxn * maxn], top;void make(int va, int vb, int opr 阅读全文
posted @ 2012-12-21 09:57 undefined2024 阅读(193) 评论(0) 推荐(0)
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 182 下一页