
动态规划
文章平均质量分 80
tshooting
努力打工,好好生活
展开
-
最大公共子串
标题:最大公共子串最大公共子串长度问题就是:求两个串的所有子串中能够匹配上的最大长度是多少。比如:"abcdkkk" 和 "baabcdadabc",可以找到的最长的公共子串是"abcd",所以最大公共子串长度为4。下面的程序是采用矩阵法进行求解的,这对串的规模不大的情况还是比较有效的解法。请分析该解法的思路,并补全划线部分缺失的代码。#include <stdio.h>#includ...原创 2018-03-24 10:54:44 · 226 阅读 · 0 评论 -
最长上升子序列 O(n^2)和O(nlogn)
最长上升子序列 【题目描述】给定N个数,求这N个数的最长上升子序列的长度。【样例输入】72 5 3 4 1 7 6【样例输出】4注:在网上看了不少关于最长上升子序列的求解方法 总结能力不太好 只能举例子了 方法一用b[i]表示以a[i]结尾的上升子序列的长度 时间复杂度为O(n^2)#include<bits/stdc++.h>using namesp...翻译 2018-03-24 16:28:03 · 186 阅读 · 0 评论 -
Anniversary party
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a ...翻译 2018-05-21 10:44:42 · 101 阅读 · 0 评论 -
Vacations
Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was c...翻译 2018-05-21 11:51:03 · 168 阅读 · 0 评论 -
odd-even number
For a number,if the length of continuous odd digits is even and the length of continuous even digits is odd,we call it odd-even number.Now we want to know the amount of odd-even number between L,R(1...翻译 2018-05-22 19:12:25 · 476 阅读 · 0 评论 -
Palindrome subsequence
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence <A,...翻译 2018-05-22 21:39:11 · 333 阅读 · 0 评论 -
命运
穿过幽谷意味着离大魔王lemon已经无限接近了! 可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑! 可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧! 命运大迷宫可以看成是一个两维的方格阵列,如下图所示: yifenfei一开始在左上角,目...原创 2018-05-23 19:11:37 · 449 阅读 · 0 评论