牛客404425958号
牛客404425958号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客404425958号的博客
全部文章
(共214篇)
题解 | #配置文件恢复#
while 1: try: s=input().split( ) #print(s) d={ 'reset board':'board fault', 'board add':'where to ...
2024-11-16
0
45
最长公共子串
s1=input() s2=input() ''' # 先识别字符串长短,再求公共子串,找最长字串 # 报红:运行超时 for s in (s1,s2): if len(s)==max(len(s1),len(s2)): long=s #print(long...
2024-11-16
0
73
题解 | #MP3光标位置#
# 每屏显示4首歌,光标初始位置为第1首歌 N=int(input()) # 歌曲数量 order=input() # 命令 U 往上/D 往下 n=4 # 每屏显示歌曲数量 cursor=1 # 光标初始位置为第1首歌 if N<=4: ...
2024-11-16
0
46
题解 | #DNA序列#
gene=input() n=int(input()) GC_l={} for i in range(len(gene)-n+1): s=gene[i:i+n] #print(s) GC_Ratio=(s.count('C')+s.count('G'))/n GC_l...
2024-11-15
0
57
题解 | #找出字符串中第一个只出现一次的字符#
s=input() s1=[] # 去重,不改变字母出现的顺序 for i in range(len(s)): if s[i] not in s1: s1.append(s[i]) #print(s1) for i in s1: if s.count(i)==1...
2024-11-15
0
53
题解 | #挑7#
n=int(input()) cnt=0 for i in range(1,n+1): if i%7==0: #print(i) cnt += 1 else: l=list(str(i)) if l.count('7')...
2024-11-15
0
45
题解 | #计算字符串的编辑距离# 动态规划
''' 替换/插入/删除,不包括交换字符顺序.最少次数 动态规划:需构建bp矩阵 ''' s1=input() s2=input() # bp[i][j]表示:由s1的前i个字母,变换为s2的前j个字母,需要的距离(包括0个字母) bp=[[i for i in range(len(s1)+1)] ...
2024-11-15
0
63
题解 | #四则运算#
s=input() s1=s.replace('{','(') s2=s1.replace('}',')') s3=s2.replace('[','(') s4=s3.replace(']',')') print(int(eval(s4))) ''' a='2*(4+2*((5-6)/3))' s...
2024-11-15
0
57
题解 | #从单向链表中删除指定值的节点#
from os import remove while 1: try: l=list(map(int,input().split())) n=l[0] l_list=[l[1]] note=[] for i i...
2024-11-15
0
46
题解 | #名字的漂亮度#
''' 字母漂亮度1-26,字母与数字唯一对应 但可以变化 字符串最大漂亮度:先计算每个字母的数量,数量最大的字母取值26,随着数量的降低依次前推 ''' n=int(input()) for i in range(n): s=list(input()) d={} for ...
2024-11-15
0
43
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页