快支棱起来的椰子很愤怒
快支棱起来的椰子很愤怒
全部文章
分类
题解(28)
归档
标签
去牛客网
登录
/
注册
快支棱起来的椰子很愤怒的博客
全部文章
(共28篇)
题解 | #子数组的最大累加和问题#
n = int(input()) nums = list(map(int, input().split())) before = nums[0] res = nums[0] for i in range(1, n): before = max(nums[i], nums[i] + befor...
Python3
2022-01-12
0
341
题解 | #用栈来求解汉诺塔问题#
n = int(input()) step = 0 def move(n, fro, to): global step step += 1 print("Move " + str(n) + " from " + fro + " to " + to) def hano...
Python3
2022-01-12
0
382
题解 | #计算数组的小和#
n = int(input()) nums = list(map(int, input().split())) def merge_sort(left, right): if left >= right: return 0 m = (left + right) ...
Python3
2022-01-12
0
427
题解 | #换钱的方法数#
n, aim = map(int, input().split()) nums = list(map(int, input().split())) dp = [0] * (aim + 1) dp[0] = 1 for i in range(n): for j in range(nums[i]...
Python3
2022-01-10
0
374
题解 | #最大值减去最小值小于或等于num的子数组数量#
n, num = map(int, input().split()) nums = list(map(int, input().split())) import collections q_max = collections.deque() q_min = collections.deque() i...
Python3
2022-01-10
0
422
题解 | #机器人达到指定位置方法数#
package main import ( "fmt" ) func main() { var n, m, k, p int var mod int = 1e9 + 7 fmt.Scan(&n, &m, &k, &p) dp ...
Go
2022-01-10
0
371
题解 | #生成窗口最大值数组#
n, k = map(int, input().split()) nums = list(map(int, input().split())) import collections stack = collections.deque() res = [] for i in range(k): ...
Python3
2022-01-10
0
419
题解 | #未排序数组中累加和小于或等于给定值的最长子数组长度#
n, k = map(int, input().split()) arr = list(map(int, input().split())) min_sums, min_ends = [0] * n, [0] * n min_sums[-1] = arr[-1] min_ends[-1] = n -...
Python3
2022-01-10
0
381
题解 | #用一个栈实现另一个栈的排序#
n = int(input()) stack = list(map(int, input().split())) additional = [] while stack: cur = stack.pop() while additional and cur < addition...
Python3
2022-01-10
0
395
题解 | #换钱的最少货币数#
l, target = map(int, input().split()) cash = list(map(int, input().split())) dp = [float("inf")] * (target + 1) dp[0] = 0 for i in range(1, target + 1...
Python3
2022-01-10
0
318
首页
上一页
1
2
3
下一页
末页