数列排序(python) 摘要:解题思路:注意事项:参考代码:n=int(input())for _ in range(n): nums=list(map(int,input().split())) left=[] …… 题解列表 2023年12月18日 0 点赞 0 评论 188 浏览 评分:0.0
绝对值排序(python) 摘要:解题思路:注意事项:参考代码:while True: nums = list(map(int, input().split())) n = nums[0] if n == 0: …… 题解列表 2023年12月18日 0 点赞 0 评论 191 浏览 评分:0.0
2999: 牛吃牧草 摘要:解题思路:#设一头牛一天吃n份草#原有s份草#每天增加a份草得方程s+20a=15n*20 s+10a=20n*10解得a/n=(15*20-20*10)/(20-10)=10注意事项:参考代码:…… 题解列表 2023年12月17日 3 点赞 0 评论 1366 浏览 评分:7.3
成绩排序(python匿名函数解法) 摘要:解题思路:思路不难,python创建一个列表存储姓名和成绩,然后再将所有人的成绩存储到一个列表当中,直接用sort函数搭配lambda匿名函数对成绩和名字的字典序进行排序,再用for循环一一输出即可注…… 题解列表 2023年12月17日 0 点赞 0 评论 298 浏览 评分:0.0
车厢调度(python) 摘要:解题思路:注意事项:参考代码:def trainSchedule(n, order): stack = [] next_car = 1 for car in order: …… 题解列表 2023年12月17日 0 点赞 0 评论 278 浏览 评分:2.0
编写题解 2787: 有一门课不及格的学生 摘要:解题思路:注意事项:参考代码:score = list(map(int, input().split())) if min(score) < 60: if max(score) >= 60…… 题解列表 2023年12月17日 1 点赞 0 评论 285 浏览 评分:10.0
合并果子(python) 摘要:解题思路:注意事项:参考代码:import heapqdef mergeFruits(fruits): heap = [] for fruit in fruits: heap…… 题解列表 2023年12月17日 0 点赞 0 评论 220 浏览 评分:0.0
二叉树遍历(python) 摘要:解题思路:注意事项:参考代码:# 定义树节点的数据结构class TreeNode: def __init__(self, val): self.val = val …… 题解列表 2023年12月17日 0 点赞 0 评论 265 浏览 评分:8.0
求后序遍历 摘要:解题思路:注意事项:参考代码:# 定义树节点的数据结构class TreeNode: def __init__(self, val): self.val = val …… 题解列表 2023年12月17日 0 点赞 0 评论 237 浏览 评分:0.0
求后序遍历(python) 摘要:解题思路:注意事项:参考代码:def build_tree(preorder, inorder): if not preorder or not inorder: return N…… 题解列表 2023年12月17日 0 点赞 0 评论 217 浏览 评分:0.0