![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
NJU-高级算法
SSSStan2090
这个作者很懒,什么都没留下…
展开
-
NJU-高级算法-时间与收益
DescriptionGivenasetofnjobswhereeachjobihasadeadlineandprofitassociatedtoit.Eachjobtakes1unitoftimetocompleteandonlyonejobcanbescheduledatatime.Weearntheprofit...原创 2019-12-08 14:05:20 · 307 阅读 · 0 评论 -
NJU-高级算法-订单问题
DescriptionRahul and Ankit are the only two waiters in Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when handled by different waiters, if Rahul takes the ...原创 2019-12-07 22:53:01 · 235 阅读 · 0 评论 -
NJU-高级算法-如何花最少的钱购买蔬菜
DescriptionRahul wanted to purchase vegetables mainly brinjal, carrot and tomato. There areNdifferent vegetable sellers in a line. Each vegetable seller sells all three vegetable items, but at dif...原创 2019-12-07 18:35:24 · 263 阅读 · 0 评论 -
NJU-高级算法-最长公共子序列
Description给定两个字符串,返回两个字符串的最长公共子序列(不是最长公共子字符串),可能是多个。Input输入第一行为用例个数, 每个测试用例输入为两行,一行一个字符串Output如果没有公共子序列,不输出,如果有多个则分为多行,按字典序排序。Sample Input 111A2BD3G4H56JK23EFG4I5J6K7Sample Output ...原创 2019-12-07 17:11:08 · 162 阅读 · 0 评论 -
NJU-高级算法-牛繁殖问题
DescriptionCows in the FooLand city are interesting animals. One of their specialties is related to producing offsprings. A cow in FooLand produces its first calve (female calf) at the age of two ye...转载 2019-11-16 12:23:17 · 585 阅读 · 0 评论 -
NJU-高级算法-子数组的取值范围
Description给定数组arr和整数num,求arr的连续子数组中满足:其最大值减去最小值的结果大于num的个数。请实现一个时间复杂度为O(length(arr))的算法。Input输入第一行为测试用例个数。每一个用例有若干行,第一行为数组,每一个数用空格隔开,第二行为num。Output输出一个值。Sample Input 113 6 4 3 22S...原创 2019-10-17 00:46:11 · 240 阅读 · 0 评论 -
NJU-高级算法-区间第k最小
Description找到给定数组的给定区间内的第K小的数值。Input输入第一行为用例个数, 每个测试用例输入的第一行为数组,每一个数用空格隔开;第二行是区间(第几个数到第几个数,两头均包含),两个值用空格隔开;第三行为K值。Output结果。Sample Input 111 2 3 4 5 6 73 52Sample Output 14思...原创 2019-10-15 22:30:50 · 179 阅读 · 0 评论 -
NJU-高级算法-子矩阵问题
子矩阵问题本文参考算法题:直方图和0-1矩阵中最大矩形原作者飞翔的蓝鲸Description给定一个矩形区域,每一个位置上都是1或0,求该矩阵中每一个位置上都是1的最大子矩形区域中的1的个数。Input输入第一行为测试用例个数。每一个用例有若干行,第一行为矩阵行数n和列数m,下面的n行每一行是用空格隔开的0或1。Output输出一个数值。Sample Input...转载 2019-10-13 23:11:26 · 217 阅读 · 0 评论 -
NJU-高级算法-数组和窗口
Description给定一个整型数组arr和一个大小为w的窗口,窗口从数组最左边滑动到最右边,每次向右滑动一个位置,求出每一次滑动时窗口内最大元素的和。Input输入第一行为用例个数, 每个测试用例输入的第一行为数组,每一个元素使用空格隔开;第二行为窗口大小。Output输出每个测试用例结果。Sample Input 114 3 5 4 3 3 6 73S...转载 2019-10-13 23:10:51 · 202 阅读 · 0 评论 -
NJU-高级算法-汉诺塔
Description汉诺塔问题中限制不能将一层塔直接从最左侧移动到最右侧,也不能直接从最右侧移动到最左侧,而是必须经过中间。求当有N层塔的时候移动步数。Input输入第一行为用例个数, 每个测试用例输入的第一行为N。Output移动步数。Sample Input 112Sample Output 18思路思路一:递归倒着看这个问题...转载 2019-10-13 23:06:53 · 392 阅读 · 0 评论