快支棱起来的椰子很愤怒
快支棱起来的椰子很愤怒
全部文章
题解
归档
标签
去牛客网
登录
/
注册
快支棱起来的椰子很愤怒的博客
全部文章
/ 题解
(共26篇)
题解 | #分金条的最小花费#
n = int(input()) nums = list(map(int, input().split())) import heapq heapq.heapify(nums) res = 0 while len(nums) > 1: a, b = heapq.heappop(nums...
Python3
2022-01-20
0
467
题解 | #容器盛水问题#
n = int(input()) if n < 3: print(0) exit() nums = list(map(int, input().split())) i, j = 0, n - 1 left_max = nums[0] right_max = nums[-1] r...
Python3
2022-01-20
0
431
题解 | #一行代码求两个数的最大公约数#
n, m = map(int, input().split()) if n < m: n, m = m, n while n % m != 0: n, m = m, n % m print(m)
Python3
2022-01-20
0
447
题解 | #打印两个升序链表的公共部分#
n = int(input()) l1 = list(map(int, input().split())) m = int(input()) l2 = list(map(int, input().split())) res = [] i, j = 0, 0 while i < n and j ...
Python3
2022-01-19
0
394
题解 | #龙与地下城游戏问题#
n, m = map(int, input().split()) matrix = [] for _ in range(n): matrix.append(list(map(int, input().split()))) dp = [0] * m dp[-1] = 1 if matrix[-...
Python3
2022-01-18
0
480
题解 | #子数组异或和为0的最多划分#
n = int(input()) nums = list(map(int, input().split())) dp = [0] * n before = {0: -1} before[nums[0]] = 0 dp[0] = 0 if nums[0] != 0 else 1 eor = nums[...
Python3
2022-01-18
0
452
题解 | #数组的partition调整补充问题#
n = int(input()) nums = list(map(int, input().split())) left, i, right = -1, 0, n while i < right: if nums[i] == 1: i += 1 cont...
Python3
2022-01-17
0
581
题解 | #数组的partition调整#
n = int(input()) nums = list(map(int, input().split())) if n < 3: print(nums) exit() i = 0 for j in range(1, len(nums)): if nums[j] != ...
Python3
2022-01-17
0
370
题解 | #数组中子数组的最大累乘积#
n = int(input()) nums = list(map(float, input().split())) bef_min = nums[0] bef_max = nums[0] res = nums[0] for i in range(1, len(nums)): bef_new_...
Python3
2022-01-17
0
398
题解 | #信封嵌套问题#
n = int(input()) envlope = [] for _ in range(n): envlope.append(list(map(int, input().split()))) envlope.sort(key = lambda x: (x[0], -x[1])) res =...
Python3
2022-01-12
0
406
首页
上一页
1
2
3
下一页
末页