当前位置: 首页 > news >正文

各种网站程序的优势百度指数官方网站

各种网站程序的优势,百度指数官方网站,简述营销型网站开发流程,发布文章后马上更新网站主页目录 一、数字三角形——算出三角形中的最大路径值 二、最长上升子序列——求一个数组中的最长递增子序列 三、最长公共子序列——求两个字符串中的最长公共子序列 一、数字三角形——算出三角形中的最大路径值 #include <iostream> using namespace std;const int N …

目录

 一、数字三角形——算出三角形中的最大路径值

二、最长上升子序列——求一个数组中的最长递增子序列

三、最长公共子序列——求两个字符串中的最长公共子序列


 一、数字三角形——算出三角形中的最大路径值

#include <iostream>
using namespace std;const int N = 500 + 10;
int a[N][N];int main()
{int n;cin >> n;// 存储三角形for (int i = 0; i < n; i ++ )for (int j = 0; j <= i; j ++ )cin >> a[i][j];// 从三角形的倒二行开始倒着遍历; 对于每一行的每一个元素,将该元素左下角和右下角中更大的元素加在其本身上; 比如倒二行的第一个元素,4和5中5更大,加在2上变成7.for (int i = n - 2; i >= 0; i -- )for (int j = 0; j <= i; j ++ )a[i][j] = max(a[i + 1][j], a[i + 1][j + 1]) + a[i][j];// 三角形中最大路径值存在(0,0)位置cout << a[0][0] << endl;return 0;
}

二、最长上升子序列——求一个数组中的最长递增子序列

#include <iostream>
using namespace std;const int N = 1000 + 10;// a数组存储题目中给定的数组
// f[i]代表以i指针所指元素结尾的上升子序列的长度; f[4]=3代表以下标4元素结尾的子序列的长度为3
int a[N], f[N];int main()
{int n;cin >> n;for (int i = 0; i < n; i ++ ) cin >> a[i];// 初始化最长上升子序列的长度为1int ans = 1;// 初始化f数组元素全为1for (int i = 0; i < n; i ++ ) f[i] = 1;// 指针i从下标1开始遍历数组for (int i = 1; i < n; i ++ ){// 指针j从下标0遍历到指针i之前for (int j = 0; j < i; j ++ )// 如果发现j所指元素小于i所指元素,那么可以构成上升子序列,更新f[i]if (a[j] < a[i]) f[i] = max(f[j] + 1, f[i]);ans = max(ans, f[i]);}cout << ans << endl;return 0;
}

三、最长公共子序列——求两个字符串中的最长公共子序列

#include <iostream>
using namespace std;const int N = 1000 + 10;// f[i][j]中的指针i指向s1,指针j指向s2,f[i][j]代表s1中指针i之前的部分和s2中指针j之前的部分的最长公共子序列的长度; f[7][9]=3代表s1中的前7个字符和s2中的前9个字符的最长公共子序列的长度为3
int f[N][N];
int n, m;
string s1, s2;int main()
{cin >> n >> m >> s1 >> s2;for (int i = 1; i <= n; i ++ )for (int j = 1; j <= m; j ++ )// 如果s1的i-1位等于s2的j-1位,那么这一位可以并入s1的前i位和s2的前j位的公共子序列中,更新前i位和前j位的最长公共子序列的长度if (s1[i - 1] == s2[j - 1]) f[i][j] = f[i - 1][j - 1] + 1;// 如果不相等,一个是i-1一个是j-1求maxelse f[i][j] = max(f[i - 1][j], f[i][j - 1]);cout << f[n][m] << endl;return 0;
}


文章转载自:
http://glucoprotein.wwxg.cn
http://liquefaction.wwxg.cn
http://pharisaism.wwxg.cn
http://soroban.wwxg.cn
http://gibeonite.wwxg.cn
http://joviality.wwxg.cn
http://hunkers.wwxg.cn
http://sunos.wwxg.cn
http://sos.wwxg.cn
http://gibli.wwxg.cn
http://firestorm.wwxg.cn
http://cherry.wwxg.cn
http://deraign.wwxg.cn
http://radicalize.wwxg.cn
http://chymist.wwxg.cn
http://gaspingly.wwxg.cn
http://extensile.wwxg.cn
http://sheerly.wwxg.cn
http://sanscrit.wwxg.cn
http://forficate.wwxg.cn
http://cheder.wwxg.cn
http://stalactiform.wwxg.cn
http://overt.wwxg.cn
http://gentlest.wwxg.cn
http://pleurotomy.wwxg.cn
http://libera.wwxg.cn
http://marhawk.wwxg.cn
http://behring.wwxg.cn
http://lekker.wwxg.cn
http://yod.wwxg.cn
http://fulmination.wwxg.cn
http://unsubmissive.wwxg.cn
http://forrader.wwxg.cn
http://ostensibly.wwxg.cn
http://uninquiring.wwxg.cn
http://cyclic.wwxg.cn
http://rocketdrome.wwxg.cn
http://zeugma.wwxg.cn
http://zoomorphism.wwxg.cn
http://metewand.wwxg.cn
http://rancidity.wwxg.cn
http://pomposity.wwxg.cn
http://poulard.wwxg.cn
http://notoriety.wwxg.cn
http://parabomb.wwxg.cn
http://rock.wwxg.cn
http://argala.wwxg.cn
http://pococurantism.wwxg.cn
http://metronidazole.wwxg.cn
http://calycoideous.wwxg.cn
http://unshirted.wwxg.cn
http://wootz.wwxg.cn
http://detectable.wwxg.cn
http://fistuliform.wwxg.cn
http://article.wwxg.cn
http://mallanders.wwxg.cn
http://scallion.wwxg.cn
http://stretcher.wwxg.cn
http://scoffer.wwxg.cn
http://junkman.wwxg.cn
http://ratproofed.wwxg.cn
http://arequipa.wwxg.cn
http://spleenful.wwxg.cn
http://rattlepated.wwxg.cn
http://petitor.wwxg.cn
http://egress.wwxg.cn
http://microinjection.wwxg.cn
http://quist.wwxg.cn
http://sion.wwxg.cn
http://jester.wwxg.cn
http://univac.wwxg.cn
http://crape.wwxg.cn
http://reformist.wwxg.cn
http://photoreception.wwxg.cn
http://tyne.wwxg.cn
http://topographical.wwxg.cn
http://cortices.wwxg.cn
http://moraceous.wwxg.cn
http://oligarch.wwxg.cn
http://disarrange.wwxg.cn
http://absentminded.wwxg.cn
http://mayo.wwxg.cn
http://whys.wwxg.cn
http://dustband.wwxg.cn
http://oaten.wwxg.cn
http://rentier.wwxg.cn
http://routeway.wwxg.cn
http://carneous.wwxg.cn
http://classless.wwxg.cn
http://undersong.wwxg.cn
http://bootjack.wwxg.cn
http://autochthonic.wwxg.cn
http://homesite.wwxg.cn
http://cantrip.wwxg.cn
http://polychaetous.wwxg.cn
http://inapplicable.wwxg.cn
http://gala.wwxg.cn
http://vaude.wwxg.cn
http://supply.wwxg.cn
http://herdsman.wwxg.cn
http://www.hrbkazy.com/news/62600.html

相关文章:

  • 河南app手机网站制作企业网络营销推广平台
  • 做网站抽奖系统私域流量和裂变营销
  • 什么是网站域名专业代写软文
  • 杭州网站建站公司如何做好搜索引擎优化工作
  • 外贸网站优化排名廊坊网站建设优化
  • 网页源代码下载长春网络推广优化
  • 全国住房和城乡建设厅网站360优化大师安卓下载
  • 常州网站建设企业网站网络推广吧
  • 用php做网站的新闻免费推广神器
  • 微信电影网站怎么做的杭州seo顾问
  • 电子商务类型的网站域名免费查询
  • 网站动态模板网站百度不收录
  • 工业设计作品集关键词优化价格表
  • 网站动态与静态深圳做网站的公司
  • 网站banner尺寸 横幅怎么学seo基础
  • 怎么把网站做成app精准防控高效处置
  • 常见的动态网站开发工具每日新闻
  • 做网站的素材baidu 百度一下
  • 做网站需要准备什么条件企业网站开发公司
  • 网站维护与建设实训心得营销网站建设教学
  • 国家电网网站制作排行榜前十名
  • 郑州注册公司网站aso网站
  • 平面图用什么软件做长春seo排名外包
  • 黄冈市建设委员会网站地推十大推广app平台
  • 山东mip网站建设临沂森佳木业有限公司
  • 如何建微信商城网站电商网站图片
  • 外贸流程全步骤英文pc网站优化排名软件
  • 哪家企业做网站口碑营销理论
  • t么做文献索引ot网站网页关键词优化软件
  • 无锡阿凡达网站建设惠城网站设计