辣椒味的糖葫芦
辣椒味的糖葫芦
全部文章
分类
归档
标签
去牛客网
登录
/
注册
辣椒味的糖葫芦的博客
全部文章
(共38篇)
题解 | #最大子矩阵#
def max_sum(num: list):#本质还是最大连续子序列 dp = [-99 for i in range(len(num) + 1)] dp[0] = num[0] for i in range(len(num)): dp[i] = max(n...
2023-03-18
0
270
题解 | #连通图#
class UnionFind:#能不能改下样例自测 def __init__(self, n): self.pt = [i for i in range(n)] self.h = [0 for i in range(n)] def find(sel...
2023-03-17
0
274
题解 | #畅通工程#
class UnionFind: def __init__(self, n: int): self.parent = [i for i in range(n)] # 初始化为:自己的父节点是自己 self.rank = [0 for i in range(n...
2023-03-17
0
320
题解 | #最大序列和#
while True:#dp思想 try: n = int(input()) num = list(map(int, input().split(' '))) dp = [0 for i in range(n)] dp[0] =...
2023-03-16
0
286
题解 | #N阶楼梯上楼问题#
n = int(input())#动态规划思想 dp = [0 for i in range(91)] dp[0], dp[1] = 1, 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] print(dp[n])
2023-03-16
0
287
题解 | #N阶楼梯上楼问题#
# 1 2 3 5 8 13 21 34 55 89 144,找规律后一眼feibunaqie n=int(input()) a=1 b=1 for i in range(n): a,b=b,a+b print(a)
2023-03-16
0
320
题解 | #谁是你的潜在朋友#
m, n = list(map(int, input().split(" ")))#示例真坑,多了个空格 book = [] ans = [0 for i in range(m)] for i in range(m): book.append(int(input())) for j in r...
2023-03-16
0
235
题解 | #开门人和关门人#
# 设计时间比较函数 # 字典存储每个人的信息 def t_bjw(s0, s1): # 比较谁晚 s0_s = int(s0[6:8]) s1_s = int(s1[6:8]) s0_m = int(s0[3:5]) s1_m = int(s1[3:5]) ...
2023-03-16
0
297
题解 | #统计同成绩学生人数#
while True: try: n = int(input()) sco = list(map(int, input().split(" "))) x = int(input()) ct = 0 for i i...
2023-03-16
0
237
题解 | #子串计算#
def zichuan(s: str): ans = [] # 储存字串 for i in range(1, len(s) + 1): for j in range(len(s) + 1 - i): ans.append(s[j : i + ...
2023-03-16
0
296
首页
上一页
1
2
3
4
下一页
末页