辣椒味的糖葫芦
辣椒味的糖葫芦
全部文章
分类
归档
标签
去牛客网
登录
/
注册
辣椒味的糖葫芦的博客
全部文章
(共38篇)
题解 | #查找学生信息#
n = int(input())#散列表相关问题可用Python的dict实现 stu = dict() for i in range(n): num = list(map(str, input().split(" "))) stu[(num[0])] = [num[1], num[...
2023-03-15
0
153
题解 | #搬水果#
while True: try:#哈夫曼树思想 n = int(input()) num = list(map(int, input().split(" "))) sum = 0 num.sort(reverse=True) ...
2023-03-15
0
269
题解 | #查找第K小数#
n = int(input()) num = list(map(int, input().split(" "))) x = int(input()) - 1 ct = 0 num.sort() if n > 1: for i in range(n - 1): if nu...
2023-03-15
0
226
题解 | #成绩排序#
# 0是降序,1是升序 #此题易错点:保证排序的稳定性 #一开始单纯先排序后reverse(),这样是不稳定的,应该在使用sorted时,就选择置reverse参数为False或True while True: try: n = int(input()) x ...
2023-03-14
0
236
题解 | #哈夫曼树#
import heapq class Node: def __init__(self, weight): self.left = None self.right = None self.weight = weight def __...
2023-03-14
0
282
题解 | #复数集合#
def ma(se): # 求模长最大 ans = [] for i in range(len(se)): if "+" in se[i]: x = se[i].split("+") a = int(x[0]) ** ...
2023-03-14
0
305
题解 | #二叉搜索树#
class Tnode:#树的结构定义 def __init__(self, data, left: None, right: None): self.data = data self.left = left self.right = righ...
2023-03-13
0
231
题解 | #二叉排序树#
class Tnode:#树的结构定义 def __init__(self, data, left: None, right: None): self.data = data self.left = left self.right = righ...
2023-03-13
0
282
题解 | #二叉树遍历#
def ans_post(pre, mid): if not pre: return "" root = pre[0] left_mid = mid[: mid.index(root)] right_mid = mid[mid.index(root) ...
2023-03-13
0
306
题解 | #二叉树遍历#
s = input() stack = []#栈实现中序输出 ps:若是队列,则是中序 ans = [] for x in s: if x != "#": stack.append(x) else: if stack: ans....
2023-03-10
0
264
首页
上一页
1
2
3
4
下一页
末页