辣椒味的糖葫芦
辣椒味的糖葫芦
全部文章
分类
归档
标签
去牛客网
登录
/
注册
辣椒味的糖葫芦的博客
全部文章
(共38篇)
题解 | #进制转换2#
def zb_n(x: int, n: int): # 10进制转为n进制 ans = [] s = "" while x: ans.append(x % n) x = x // n ans.reverse() for i i...
2023-03-22
0
303
题解 | #成绩排序#
n = int(input()) stu = [] for i in range(n): a, b = map(int, input().split(" ")) stu.append((a, b)) stu.sort(key=lambda x: (x[1], x[0]))#sort内...
2023-03-22
0
303
题解 | #排序#
import heapq def px(nums:list):#堆排序 ans=[] while nums: heapq.heapify(nums) ans.append(nums[0]) del(nums[0]) return...
2023-03-22
0
286
题解 | #继续畅通工程#
class UnionFind: def __init__(self,n): self.pt=[i for i in range(n+1)] self.h=[0 for i in range(n+1)] def find(self,x): ...
2023-03-21
0
344
题解 | #还是畅通工程#
class UnionFind:#最小生成树经典 def __init__(self, n): self.pt = [i for i in range(n + 1)]#切记要多存储一些,防止越界(遇到越界,就多点空间试试) self.h = [0 for i ...
2023-03-21
0
361
题解 | #采药#
t, n = map(int, input().split(" "))#01背包 time = [0 for i in range(n)] v = [0 for i in range(n)] dp = [0 for i in range(t + 1)] for i in range(n): ...
2023-03-19
0
314
题解 | #点菜问题#
while True: try: m, n = map(int, input().split(" ")) w = [0 for i in range(n)] # 钱大小 v = [0 for i in range(n)] # 分数 ...
2023-03-19
0
331
题解 | #Coincidence#
s0 = input() s1 = input() m, n = len(s0), len(s1) dp = [[0 for i in range(n + 1)] for j in range(m + 1)]#dp是递推,大小需要多个1 for i in range(m): for j in...
2023-03-19
0
304
题解 | #最大上升子序列和#
n = int(input()) num = list(map(int, input().split(" "))) dp = list(num)#记住,一定要加个list(),否则就是同一个内存地址 for i in range(n): for j in range(i): ...
2023-03-18
0
343
题解 | #拦截导弹#
n = int(input()) num = list(map(int, input().split(" "))) dp = [1 for i in range(n)] # 初始为1 for i in range(n): for j in range(i): if num[...
2023-03-18
0
320
首页
上一页
1
2
3
4
下一页
末页