柚茶_Rola
柚茶_Rola
全部文章
分类
归档
标签
去牛客网
登录
/
注册
柚茶_Rola的博客
全部文章
(共451篇)
题解 | #查找两个字符串a,b中的最长公共子串#
s1 = input() s2 = input() if len(s1) > len(s2): s1,s2 = s2,s1 p = 0 s = '' for i in range(len(s1)): for j in range(i,len(s1)): if (...
2024-10-24
0
26
题解 | #公共子串计算#
s1 = input().lower() # 短 s2 = input().lower() # 长 if len(s1) > len(s2): s1,s2 = s2,s1 p = 0 for i in range(len(s1)): for j in...
2024-10-24
0
43
题解 | #查找两个字符串a,b中的最长公共子串#
s1 = input() s2 = input() if len(s1) > len(s2): s1,s2 = s2,s1 p = 0 s = '' for i in range(len(s1)): for j in range(i+1,len(s1)): if...
2024-10-24
0
36
题解 | #DNA序列#
s = input() N = int(input()) ls = [] for i in range(0,len(s)): ls.append(s[i:i+N]) #print(ls) lst = [] for i in ls: if len(i) == N: ls...
2024-10-24
0
30
题解 | #找出字符串中第一个只出现一次的字符#
s = input() d = {} for i in s: if i not in d: d[i] = s.count(i) ls = [] for k,v in d.items(): if v == 1: ls.append(k) if len(l...
2024-10-24
0
35
题解 | #计算字符串的编辑距离#
A = input() B = input() m = len(A) n = len(B) dp = [[1 for j in range(n + 1)] for i in range(m + 1)] for i in range(m + 1): # 第0列 dp[i][0] = i fo...
2024-10-24
0
45
题解 | #四则运算#
s = input() s = s.replace('{','(') s = s.replace('}',')') s = s.replace('[','(') s = s.replace(']',')') print(int(eval(s)))
2024-10-24
0
33
题解 | #迷宫问题#
def walk(i, j, pos=[(0, 0)]): if (j + 1 < m) and (maze[i][j + 1] == 0): if (i, j + 1) not in pos: walk(i, j + 1, pos + [(i,...
2024-10-23
0
61
题解 | #迷宫问题#
def walk(i,j,pos=[(0,0)]): if j+1 < m and maze[i][j+1] == 0: if (i,j+1) not in pos: walk(i,j+1,pos+[(i,j+1)]) if j-1 &g...
2024-10-23
0
26
题解 | #迷宫问题#
while True: try: n,m = list(map(int,input().split())) # maze = [] for _ in range(n): #n是行 maze.append(list(m...
2024-10-23
0
48
首页
上一页
2
3
4
5
6
7
8
9
10
11
下一页
末页