papybara
papybara
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
papybara的博客
全部文章
(共20篇)
题解 | 配置文件恢复
import re import sys 构造双层字典 dic = { "reset": {"board": "board fault"}, "board": {"add": &quo...
2025-08-10
0
20
题解 | 参数解析
# 直接用re秒杀 #[]是取其中的字符,[]中的^代表not,|代表或,【"[^"]+"】,匹配 1-n个被双引号包裹,且内部不含双引号的字符串 import re s = input() l = re.findall(r'"[^"]+"...
2025-08-08
0
22
题解 | 合法IP
import sys for line in sys.stdin: s = line.strip().split(".") if len(s) != 4: print("NO") break for i...
2025-08-07
0
15
题解 | 仰望水面的歪
from math import gcd import sys n,h = map(int,(input().split())) for line in sys.stdin: x,y,z = map(int,(line.split())) z = 2*h-z x,y,z = ...
2025-08-07
0
19
题解 | 从单向链表中删除指定值的节点
l = input().split() res = [l[1]] for i in range(1,int(l[0])):#循环到给定长度 res.insert(res.index(l[2*i+1])+1,l[2*i])#2*i+1是前数字,2*i是要插入的数字 res.remove(l[-...
2025-08-07
0
15
题解 | 统计大写字母个数
s = input().strip() print(list(map(str.isupper,s)).count(True))
2025-08-06
0
19
题解 | 在字符串中找出连续最长的数字串
s = input().strip() for i in s: if i.isalpha(): s = s.replace(i,' ') l =s.split(' ') lmax = max(map(len,l)) for i in l: if len(i)==l...
2025-08-06
0
17
题解 | 字符串加密
import sys s = input().strip() t = input().strip() # 去重 l = sorted(set(list(s)),key = s.index) # 按字母表顺序增加 alphabet = 'abcdefghijklmnopqrstuvwxyz' fo...
2025-08-05
0
26
题解 | 蛇形矩阵
import sys n = int(input()) # 构造空蛇形列表 lis0=[] for i in range(n): lis0.append([0]*(n-i)) # 按照角标顺序填入值 k = 1 for i in range(n): for u in range(...
2025-08-05
0
16
题解 | 简单错误记录
import sys path_dict={} for line in sys.stdin: path,line_number = line.split() #取出文件路径和行号 path_end = path.split('\\')[-1] #取出文件短路径 path16 ...
2025-08-02
0
26
首页
上一页
1
2
下一页
末页