牛客595509241号
牛客595509241号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客595509241号的博客
全部文章
/ 题解
(共15篇)
题解 | #MP3光标位置#
""" 思路: 所有歌曲是一个列表 a 屏幕显示的四个歌曲,是一个长度为 4 的列表 b 按 U: 1、下标为 0 时,若值为 a[0],更新列表为 a 最后的四个歌曲,下标移到 3 2、下标为 0 时,若值不为 a[0],b 列表统一前移,下...
Python3
2022-04-21
0
336
题解 | #学英语#
英文的数字以三位进,拿到输入后用取商和模的方式三位分隔,得到 个位-百位,千位-十万位,百万位-亿位 如:316540,个位-百位:540,千位-十万位:316,百万位-亿位:000 这样每个数字最大是 999 定义两个函数,分别处理 100 以内的数字转英文,100-999 以内的数字转英文,...
Python3
2022-04-17
2
428
题解 | #明明的随机数#
思路: 使用集合去重,转为列表用 sort 排序 while True: try: count = input().strip() s = set() for num in range(int(count)): s.ad...
Python3
2022-04-16
0
208
题解 | #公共子串计算#
""" 获取两个输入 设最大长度为 0 建立一个二维列表,不用考虑两个列表的长度,均偏移 1 两层循环,两个指针,比较两个输入的字符串是否相等 如果相等,将两个下标对应的二维列表的值 +1,赋给偏移后的值 如果该值大于当前最大长度,则更新最大长度的值 返回最大长度的值即可 """ def dyp(...
Python3
2022-04-15
0
325
题解 | #字符串最后一个单词的长度#
str1 = input() arr = str1.split(" ") while True: str2 = arr.pop() if len(str2) == 0: continue print(len(str2)) break
Python3
2022-04-14
0
283
题解 | #四则运算#
s = input() s = s.replace("{", "(") s = s.replace("}", ")") s = s.replace("[", "(") s = s.replace("]", ")") print(int(eval(s)))
Python3
2022-04-14
0
348
题解 | #火车进站#
引自:https://blog.nowcoder.net/n/c966740408d945b8bccf72ffdc5dd636 res = [] def dfs(wait, stack, out): if not wait and not stack: res.appen...
Python3
2022-04-14
6
547
题解 | #矩阵乘法#
x = int(input()) y = int(input()) z = int(input()) firstArray = [] secondArray = [] for i in range(x): firstArray.append(list(map(int, input().spl...
Python3
2022-04-14
0
308
题解 | #挑7#
n = int(input()) count = 0 for i in range(n): num = i + 1 divisible = num % 7 include_seven = False for j in range(len(str(num))): ...
Python3
2022-04-14
0
285
题解 | #DNA序列#
# 获取输入1,去掉前后空格 dna = input().strip() # 获取输入2 length = input().strip() # 使用 for 循环,遍历输入 1,每次获取输入 2 的长度的字符串,计算 C 和 G 的比例,将比例放入列表一,字串放入列表二 # 只有新的计算结果比列表一...
Python3
2022-04-14
0
375
首页
上一页
1
2
下一页
末页