摘要: /* 很好的字符串 比较方法 很多个字符串 组成的 数字 需要最大 然后 比较 a和b 是 比较a+b 和b+a 的大小*/#include#include#include#includeusing namespace std;struct point{ char str[100];}T[55];bool cmp(point A,point B){ int i,a=strlen(A.str),b=strlen(B.str); point C=A,D=B; for(i=0;iD.str[i]; } return true;}int main(){ int n,i; c... 阅读全文
posted @ 2014-03-09 22:38 来自大山深处的菜鸟 阅读(145) 评论(0) 推荐(0) 编辑
摘要: /* 最长公共子序列*/#include #include #include const int maxn=105;int N[maxn],M[maxn];int dp[2][maxn];int main(){ int i,j,n,m,num=0; while(true){ scanf("%d%d",&n,&m); if(n==0&&m==0) break; for(i=0;idp[d^1][j]?dp[d][j-1]:dp[d^1][j]; } d=d^1; } printf("Twin Towers #%d\n",++ 阅读全文
posted @ 2014-03-09 21:33 来自大山深处的菜鸟 阅读(184) 评论(0) 推荐(0) 编辑
摘要: /* (栈)这里 有一个需要知道的 如果一个点走出了 原来的 位置 那么它最早的那个位置的 当他在回到原来位置的时候 可能还会有 块在那个下面 根据这点 我们就可以 大胆 的进行出栈入栈操作 */#include #include #include using namespace std;int L[30],N[30][30],num[30],t1,t2,A,B,KH[30],n;void dec(int er){ int i,LOC=L[er]; for(i=num[LOC];i>=1;i--){ if(N[LOC][i]==er) break; int d=N[LOC... 阅读全文
posted @ 2014-03-09 20:26 来自大山深处的菜鸟 阅读(312) 评论(0) 推荐(0) 编辑