dthcle_
dthcle_
全部文章
分类
归档
标签
去牛客网
登录
/
注册
dthcle_的博客
全部文章
(共42篇)
题解 | 公共子串计算
s = input() t = input() dp = [[0] * (len(s) + 1) for _ in range(len(t) + 1)] max_value = 0 for i in range(1, len(t)+1): for j in range(1, len(s)+...
2026-01-16
0
25
题解 | 参数解析
题干没说一个命令可能用两个空格隔开=-=测了一下果然有对应的用例 cmd = input() result = [] curr_cmd = [] in_yinhao = False for each in cmd: if in_yinhao: if each == &quo...
2026-01-16
0
19
题解 | 字符串通配符
递归法,注意处理"*"问题re匹配 a = input().lower() b = input().lower() def is_alnum(c): return ord("a") <= ord(c) <= ord("z&quo...
2026-01-15
0
26
题解 | 矩阵乘法计算量估算
注意进出栈的顺序 from collections import deque n = int(input()) def get_num(c): return ord(c) - ord("A") def m_mul(ah, aw, bh, bw): tmp =...
2026-01-15
0
20
题解 | 矩阵乘法
a_h = int(input()) a_w = b_h = int(input()) b_w = int(input()) a = [] b = [] for y in range(a_h): a.append(list(map(int, input().split()))) for y...
2026-01-15
0
19
题解 | 24点游戏算法
为了保证数据精度,新加了个类,结果一大半时间在改类的bug。=-=哎 a, b, c, d = map(int, input().split()) class DDNum: def __init__(self, u, d=1): self.u = u se...
2026-01-14
0
30
题解 | 配置文件恢复
简单的字符串匹配 import sys commands = { ("reset", "board"): "board fault", ("board", "add"): "...
2026-01-13
0
21
题解 | 查找两个字符串a,b中的最长公共子串
python的max()对二维数组的行为是:按照字典序返回最大值,而不是每一行返回一个最大值=-=。哎。 s = input() t = input() if len(t) > len(s): s, t = t, s dp = [[0] * (len(s)+1) for _ in ...
2026-01-13
0
15
题解 | MP3光标位置
哎,边界条件,0起1起傻傻分不清 n = int(input()) def move_large_4(pos, screen_head, direction, total): if direction == "U": if pos == screen_h...
2026-01-12
0
16
题解 | DNA序列
一维动态规划 s = input() N = int(input()) # 起始点 add_CG_result_list = [0] * len(s) # 以第n个字母为开头时 CG比例的变化情况 for each in range(1, len(s)-N+1): do_add = 0 ...
2026-01-12
0
18
首页
上一页
1
2
3
4
5
下一页
末页