大赛将至,摆在你面前的是n道题目,第 i(1 ≤ i ≤ n) 道题目能提升 ai 点智力值,代码量为 bi KB,无聊值为 ci ,求至少提升m点智力值的情况下,所做题目代码量之和*无聊值之和最小为多少. Input 第一行两个整数n,m(0<n<=400) 接下来n行每行三个整数,ai,bi,ci(0<bi,ci<=1000,0<ai<=800). 0<m<=Σai<=800 Output 一个数,至少提升m点智力值的情况下,所做题目代码量之和*无
Given a string S and a string T, count the number of distinct subsequences ofT inS. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative po
平时接触树还比较少,写一篇博文来积累一下树的相关知识. 很早之前在数据结构里面学的树的遍历. 前序遍历:根节点->左子树->右子树 中序遍历:左子树->根节点->右子树 后序遍历:左子树->右子树->根节点 例如:求下面树的三种遍历 前序遍历:abdefgc 中序遍历:debgfac 后序遍历:edgfbca 下面来记录一下今天在九度上面做的一道上海交大的机试题: 题目描述: We are all familiar with pre-order, in-order an