柚茶_Rola
柚茶_Rola
全部文章
分类
归档
标签
去牛客网
登录
/
注册
柚茶_Rola的博客
全部文章
(共451篇)
题解 | #矩阵乘法#
x = int(input()) y = int(input()) z = int(input()) A = [] # x行y列 B = [] # y行z列 C = [[0 for j in range(z)]for i in range(x)] # x行z列 # 输入A矩阵 for...
2024-03-13
0
232
题解 | #24点游戏算法#
### 有参考大佬的写法。。。 def f(nums,res): if len(nums) == 1: #这是递归的出口 return nums[0] == res else: for i in range(len(nums)): ...
2024-03-13
0
203
题解 | #配置文件恢复#
''' 也是参考别的大佬写的。。。,为啥用字典写的逻辑感觉都对,但是不能提交 ''' while True: try: m = input().strip().split() key = ["reset","reset boa...
2024-03-13
0
253
题解 | #查找两个字符串a,b中的最长公共子串#
a = input().strip() # 短abcdefghijklmnop b = input().strip() # 长abcsafjklmnopqrstuvw ls = [] res = [] ## jklmnop if len(a) > len(b): a,b = b,a ...
2024-03-11
0
175
题解 | #找出字符串中第一个只出现一次的字符#
s = input() # asdfasdfoe dic = {} res = [] for i in s: if i not in dic: dic[i] = s.count(i) if dic[i] == 1: res.append...
2024-03-09
0
143
题解 | #高精度整数加法#
n1 = int(input()) n2 = int(input()) print(n1 + n2)
2024-03-09
0
132
题解 | #挑7#
n = int(input()) c = 0 for i in range(1,n+1): #1 2 3 4 5 if '7' in str(i) or i%7 == 0: c += 1 print(c)
2024-03-09
0
154
题解 | #计算字符串的编辑距离#
s1 = input()# abcdefg,行 s2 = input()# abcdef 列 dp = [[x for x in range(len(s2)+1)]for y in range(len(s1)+1)] # 现在dp列表中每一行值是0,1,2,3.。。,len(s2) # 现在要改变第...
2024-03-09
0
163
题解 | #从单向链表中删除指定值的节点#
ls = input().split() # 6 2 1 2 3 2 5 1 4 5 7 2 2 head = ls[1] #头结点 rm = ls[-1] #要删除的结点 ans = [head] # 结果列表 ls1 = ls[2:-1][::2] ...
2024-03-09
0
182
题解 | #迷宫问题#
# 2024年1月20日 周四 上午9:56 晴 # wujie # maze = 迷宫 # pos= 位置 ### 此题不难,用的是递归方法,需要多看几遍 ########### 得空的时候研究一下,这个题还有没有其他的解法 m, n = list(map(int, input().sp...
2024-03-08
0
195
首页
上一页
29
30
31
32
33
34
35
36
37
38
下一页
末页