摘要: #include#includeint c[101][101],f[101][101],p[101],m,n,d[10000],pre[101];int main(){ int i,j,k=1,top,last; scanf("%d%d",&n,&m); int x,y,z; ... 阅读全文
posted @ 2014-09-14 11:40 cnyali 阅读(157) 评论(0) 推荐(0) 编辑
摘要: #include#includeint a[101][101],d[101],m,n,p[101];int dfs(int x){ int i,j,k; for(i=1;i<=n;i++) if(a[x][i] && !p[i]){ p[i]=1; ... 阅读全文
posted @ 2014-09-14 11:16 cnyali 阅读(122) 评论(0) 推荐(0) 编辑
摘要: O(nlogn)的算法关键是它建立了一个数组temp[],temp[i]表示长度为i的不下降序列中结尾元素的最小值,用top表示数组目前的长度,算法完成后top的值即为最长不下降子序列的长度。设当前的以求出的长度为top,则判断num[i]和temp[top]:1.如果num[i]>=temp[to... 阅读全文
posted @ 2014-09-14 11:15 cnyali 阅读(130) 评论(0) 推荐(0) 编辑