NJU-高级算法
SSSStan2090
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
NJU-高级算法-时间与收益
Description Givenasetofnjobswhereeachjobihasadeadlineandprofitassociatedtoit.Eachjobtakes1unitoftimetocompleteandonlyonejobcanbescheduledatatime.Weearntheprofit...原创 2019-12-08 14:05:20 · 401 阅读 · 0 评论 -
NJU-高级算法-订单问题
Description Rahul 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 · 336 阅读 · 0 评论 -
NJU-高级算法-如何花最少的钱购买蔬菜
Description Rahul 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 · 355 阅读 · 0 评论 -
NJU-高级算法-最长公共子序列
Description 给定两个字符串,返回两个字符串的最长公共子序列(不是最长公共子字符串),可能是多个。 Input 输入第一行为用例个数, 每个测试用例输入为两行,一行一个字符串 Output 如果没有公共子序列,不输出,如果有多个则分为多行,按字典序排序。 Sample Input 1 1 1A2BD3G4H56JK 23EFG4I5J6K7 Sample Output ...原创 2019-12-07 17:11:08 · 253 阅读 · 0 评论 -
NJU-高级算法-牛繁殖问题
Description Cows 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 · 707 阅读 · 0 评论 -
NJU-高级算法-子数组的取值范围
Description 给定数组arr和整数num,求arr的连续子数组中满足:其最大值减去最小值的结果大于num的个数。请实现一个时间复杂度为O(length(arr))的算法。 Input 输入第一行为测试用例个数。每一个用例有若干行,第一行为数组,每一个数用空格隔开,第二行为num。 Output 输出一个值。 Sample Input 1 1 3 6 4 3 2 2 S...原创 2019-10-17 00:46:11 · 383 阅读 · 0 评论 -
NJU-高级算法-区间第k最小
Description 找到给定数组的给定区间内的第K小的数值。 Input 输入第一行为用例个数, 每个测试用例输入的第一行为数组,每一个数用空格隔开;第二行是区间(第几个数到第几个数,两头均包含),两个值用空格隔开;第三行为K值。 Output 结果。 Sample Input 1 1 1 2 3 4 5 6 7 3 5 2 Sample Output 1 4 思...原创 2019-10-15 22:30:50 · 258 阅读 · 0 评论 -
NJU-高级算法-子矩阵问题
子矩阵问题 本文参考算法题:直方图和0-1矩阵中最大矩形 原作者飞翔的蓝鲸 Description 给定一个矩形区域,每一个位置上都是1或0,求该矩阵中每一个位置上都是1的最大子矩形区域中的1的个数。 Input 输入第一行为测试用例个数。每一个用例有若干行,第一行为矩阵行数n和列数m,下面的n行每一行是用空格隔开的0或1。 Output 输出一个数值。 Sample Input...转载 2019-10-13 23:11:26 · 327 阅读 · 0 评论 -
NJU-高级算法-数组和窗口
Description 给定一个整型数组arr和一个大小为w的窗口,窗口从数组最左边滑动到最右边,每次向右滑动一个位置,求出每一次滑动时窗口内最大元素的和。 Input 输入第一行为用例个数, 每个测试用例输入的第一行为数组,每一个元素使用空格隔开;第二行为窗口大小。 Output 输出每个测试用例结果。 Sample Input 1 1 4 3 5 4 3 3 6 7 3 S...转载 2019-10-13 23:10:51 · 316 阅读 · 0 评论 -
NJU-高级算法-汉诺塔
Description 汉诺塔问题中限制不能将一层塔直接从最左侧移动到最右侧,也不能直接从最右侧移动到最左侧,而是必须经过中间。求当有N层塔的时候移动步数。 Input 输入第一行为用例个数, 每个测试用例输入的第一行为N。 Output 移动步数。 Sample Input 1 1 2 Sample Output 1 8 思路 思路一:递归 倒着看这个问题...转载 2019-10-13 23:06:53 · 615 阅读 · 0 评论
分享