{"rsdb":{"rid":"29659","subhead":"","postdate":"0","aid":"22939","fid":"80","uid":"1","topic":"1","content":"

\u3000\u3000\u4e00\u3001\u7b97\u6cd5\u601d\u60f3<\/strong><\/p>

\u3000\u3000\u4e00\u4e2a\u7ed9\u5b9a\u5e8f\u5217\u7684\u5b50\u5e8f\u5217\u662f\u5728\u8be5\u5e8f\u5217\u4e2d\u5220\u53bb\u82e5\u5e72\u5143\u7d20\u540e\u5f97\u5230\u7684\u5e8f\u5217\u3002\u7ed9\u5b9a\u4e24\u4e2a\u5e8f\u5217X\u548cY\uff0c\u5f53\u53e6\u4e00\u5e8f\u5217Z\u65e2\u662fX\u7684\u5b50\u5e8f\u5217\u53c8\u662fY\u7684\u5b50\u5e8f\u5217\u65f6\uff0c\u79f0Z\u662f\u5e8f\u5217X \u548cY\u7684\u516c\u5171\u5b50\u5e8f\u5217\u3002\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u5c31\u662f\u6c42\u7ed9\u5b9a\u4e24\u4e2a\u5e8f\u5217\u7684\u4e00\u4e2a\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u3002\u52a8\u6001\u89c4\u5212\u53ef\u4ee5\u6709\u6548\u7684\u89e3\u51b3\u6b64\u95ee\u9898\u3002\u7531\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u95ee\u9898\u7684\u5b50\u5e8f\u5217\u7684\u6700\u4f18\u5b50\u7ed3\u6784\u6027\u8d28\uff0c\u53ef\u4ee5\u5efa\u7acb\u5b50\u95ee\u9898\u6700\u4f18\u7684\u9012\u5f52\u5173\u7cfb\u3002\u7528c[i][j]\u8bb0\u5f55\u5e8f\u5217Xi\u548cYi\u7684\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u7684\u957f\u5ea6\uff0c\u9012\u5f52\u5173\u7cfb\u5982\u4e0b\uff1a<\/p>

\u3000\u30000 i=0,j=0<\/p>

\u3000\u3000c[i][j]= c[i-1][j][j-1]+1 i,j> 0;xi==yj<\/p>

\u3000\u3000max c[i][j-1],c[i-1][j] I,j> 0;xi==yj<\/p>

\u3000\u3000\u5728\u5177\u4f53\u7684\u7b97\u6cd5\u8bbe\u8ba1\u4e2d\uff0c\u4ee5\u5e8f\u5217X= { x1,x2,x3,\u2026,xm }\u548cY= {y1,y2,y3,\u2026,ym}\u4f5c\u4e3a\u8f93\u5165\u3002\u8f93\u51fa\u4e09\u4e2a\u6570\u7ec4c,b,temp\u3002\u5176\u4e2dc[i][j]\u5b58\u50a8Xi\u548cYj\u7684\u516c\u5171\u5b50\u5e8f\u5217\u7684\u957f\u5ea6\uff0cb[i][j]\u8bb0\u5f55c[i][j]\u7684\u503c\u662f\u7531\u54ea\u4e00\u4e2a\u5b50\u95ee\u9898\u7684\u89e3\u5f97\u5230\u7684\uff0c\u8fd9\u5728\u6784\u9020\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u65f6\u8981\u7528\u5230\u3002\u95ee\u9898\u5f97\u6700\u4f18\u89e3\uff0c\u5373X\u548cY\u5f97\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u8bb0\u5f55\u5728temp[h]\u4e2d\u3002<\/p>

\u3000\u3000\u4e8c\u3001\u6e90\u4ee3\u7801<\/strong><\/p>

\u3000\u3000\u4e0b\u9762\u662f\u5728Microsoft Visual C++<\/a> 6.0\u4e2d\u7f16\u5199\u7684\u6c42\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217\u7684\u6e90\u7a0b\u5e8f\uff0c\u7a0b\u5e8f\u5b9a\u4e49\u4e86\u6700\u5927\u5f97\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a99\uff0c\u662f\u5c06p48\u9875\u7684\u52a8\u6001\u89c4\u5212\u7b97\u6cd5\u6539\u5199\u800c\u6765\u7684\u3002<\/p>

\u3000\u3000#include \n <\/iostream.h><\/p>

\u3000\u3000#include \n <\/iomanip.h><\/p>

\u3000\u3000#define MAX 99<\/p>

\u3000\u3000\/\/typedef char MM;<\/p>

\u3000\u3000void main()<\/p>

\u3000\u3000{ int i,j,m,n,h=0;<\/p>

\u3000\u3000char x[MAX]={ ' ', ' '},y[MAX]={ ' ', ' '},b[MAX][MAX]={ ' '};<\/p>

\u3000\u3000int c[MAX][MAX]={0};<\/p>

\u3000\u3000char temp[MAX]={ ' '};<\/p>

\u3000\u3000cout < < \"**\u672c\u7a0b\u5e8f\u53ef\u4ee5\u6c42\u5f97\u5b57\u7b26\u6570\u572899\u4ee5\u5185\u7684\u4efb\u610f\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u6700\u5927\u516c\u5171\u5b50\u5e8f\u5217**\\n \";<\/p>

\u3000\u3000cout < < \"\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u957f\u5ea6m= \";<\/p>

\u3000\u3000cin> > m;<\/p>

\u3000\u3000cout < < \"\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32(\u201c\u56de\u8f66\u201d\u7ed3\u675f)\\n\u5982\u679c\u8f93\u5165\u7684\u5b57\u7b26\u6570\u8d85\u8fc7m,\u5219\u4f1a\u51fa\u9519!\\nx[ \" < \n \n <\/m><\/p>

\u3000\u3000for(i=1;i <=m;i++)<\/p>

\u3000\u3000cin> > x[i]; \/\/\u952e\u76d8\u8f93\u5165x\u548cy<\/p>

\u3000\u3000cout < < \"\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u7684\u957f\u5ea6n= \";<\/p>

\u3000\u3000cin> > n;<\/p>","orderid":"0","title":"\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217","smalltitle":"","mid":"0","fname":"\u8ba1\u7b97\u673a\u4e8c\u7ea7\u8003\u8bd5C++","special_id":"0","bak_id":"0","info":"0","hits":"847","pages":"1","comments":"0","posttime":"2014-11-23 22:16:32","list":"1416752192","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"\u6700\u957f<\/A> \u516c\u5171<\/A> \u5e8f\u5217<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"114.215.104.12","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"\u6700\u957f\u516c\u5171\u5b50\u5e8f\u5217","lastview":"1713875522","digg_num":"8616","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}