#include#include#include#include#include#include#include#include" />

日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

hdu1159-Common Subsequence

系統 1806 0

Common Subsequence

dp之最長公共子序列

?

    // File Name: hdu1159.cpp

// Author: rudolf

// Created Time: 2013年04月25日 星期四 12時12分33秒



#include<vector>

#include<list>

#include<map>

#include<set>

#include<deque>

#include<stack>

#include<bitset>

#include<algorithm>

#include<functional>

#include<numeric>

#include<utility>

#include<sstream>

#include<iostream>

#include<iomanip>

#include<cstdio>

#include<cmath>

#include<cstdlib>

#include<cstring>

#include<ctime>

#include<string>

using namespace std;

const int maxn=1005;

int dp[maxn][maxn];

int main()

{

	int len1,len2;

	string str1,str2;

	while(cin>>str1>>str2)

	{

		memset(dp,0,sizeof(dp));

		for(int i=0;i<str1.length();i++)

			for(int j=0;j<str2.length();j++)

			{

				if(str1[i]==str2[j])

					dp[i+1][j+1]=dp[i][j]+1;

				else

					dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);

			}

		cout<<dp[str1.length()][str2.length()]<<endl;



	}

return 0;

}	
  


?

?

hdu1159-Common Subsequence


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 库伦旗| 淳化县| 五台县| 清新县| 阿克苏市| 新乡县| 镇雄县| 武穴市| 德保县| 廉江市| 钦州市| 武平县| 云和县| 横峰县| 哈尔滨市| 皮山县| 西宁市| 吐鲁番市| 梁平县| 嘉鱼县| 西乡县| 开江县| 九台市| 库车县| 英超| 从化市| 云浮市| 长宁县| 城固县| 拉孜县| 五大连池市| 阜新市| 安龙县| 杭锦后旗| 南皮县| 稷山县| 祁门县| 韶山市| 迭部县| 治多县| 资中县|