摘要: 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn(Pi为整数)。求背包能够容纳的最大价值。 在N件物品取出若干件放在容量为W的背包里,每件物品的体积为W1,W2……Wn(Wi为整数),与之相对应的价值为P1,P2……Pn 阅读全文
posted @ 2017-08-10 17:13 ⊙∽⊙Perseverance 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 描述给定一整型数列{a1,a2...,an},找出连续非空子串{ax,ax+1,...,ay},使得该子序列的和最大,其中,1<=x<=y<=n。 阅读全文
posted @ 2017-08-09 19:40 ⊙∽⊙Perseverance 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 描述咱们就不拐弯抹角了,如题,需要你做的就是写一个程序,得出最长公共子序列。tip:最长公共子序列也称作最长公共子串(不要求连续),英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此条件序列中最长的 阅读全文
posted @ 2017-08-09 17:59 ⊙∽⊙Perseverance 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 描述求一个字符串的最长递增子序列的长度如:dabdbf最长递增子序列就是abdf,长度为4 阅读全文
posted @ 2017-08-09 17:33 ⊙∽⊙Perseverance 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定一个很大的整数,我想知道它能否被9整除。 给定一个很大的整数,我想知道它能否被9整除。 输入 有t组测试数据,每组数据给定一个整数N不存在前导0。(1 <= t <= 20,1 <= N <= 10^200)。 有t组测试数据,每组数据给定一个整数N不存在前导0。(1 <= t <= 阅读全文
posted @ 2017-08-08 18:29 ⊙∽⊙Perseverance 阅读(108) 评论(0) 推荐(0) 编辑
摘要: "OK, you are not too bad, em... But you can never pass the next test." feng5166 says. "I will tell you an odd number N, and then N integers. There wil 阅读全文
posted @ 2017-08-08 11:06 ⊙∽⊙Perseverance 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this 阅读全文
posted @ 2017-08-08 11:03 ⊙∽⊙Perseverance 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 鹏神意外得到了神灯。 神灯中冒出了灯神,灯神说道:“我将给你一个有序的数列,你可以在保证原有顺序不变的前提下,挑出任意多的数。如果你挑出的数字是严格升序的,那么这段数字的个数就是你女朋友的个数。” “妈的智障。”鹏神骂道。 但是鹏神还是希望自己能有尽可能多的女朋友。所以他求救于你,希望你能帮他算出他 阅读全文
posted @ 2017-08-08 10:58 ⊙∽⊙Perseverance 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 LCS 3 4 BDCABA 5 ABCBDAB 6 7 dp[1][2] = 1 8 dp[1][1] = 0 9 dp[2][1] = 0 10 11 //子串:连续 12 //子序列:可以不连续 13 // LCS 14 15 dp[i][j]//第一个字符串在第i个字符前且第二个串在第j个字符前可构成的最长子序列的长度 16 17 dp[i]... 阅读全文
posted @ 2017-08-08 10:19 ⊙∽⊙Perseverance 阅读(458) 评论(0) 推荐(0) 编辑
摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another 阅读全文
posted @ 2017-08-08 10:15 ⊙∽⊙Perseverance 阅读(133) 评论(0) 推荐(0) 编辑