Super_Tea
Super_Tea
全部文章
分类
归档
标签
去牛客网
登录
/
注册
Supra
Yuan是神!
全部文章
(共12篇)
题解 | 字符串通配符
直接使用RE! import re print('true' if re.fullmatch(input().replace('**','*').replace('*', '[a-zA-Z0-9]*').replace('?', '[a-zA-Z0-9]'), input(), re.IGNOREC...
2025-03-23
0
16
题解 | 四则运算
唉,python的eval在这种问题上就是神中神[doge] print(int(eval(input().replace('[','(').replace(']',')').replace('{','(').replace('}',')')))) #牛客春招刷题训练营# + 链接
2025-03-14
0
24
题解 | 迷宫问题
其实可以有一个 n^4 的dp(真的能说是dp嘛,虽然确实是转移),但是怀疑python过不去,还是老老实实dfs[doge] h, w = list(map(int,input().split())) mp = [list(map(int,input().split())) for i in ra...
2025-03-14
0
22
题解 | 合唱队
n^2的基础dp,理论上应该能够直接用n^2通过,但是Python3不太给力,用Pypy3就可以了/ n = int(input()) ans = 0 lst = list(map(int,input().split())) dpl = [0 for x in range(n)] dpr = [0 ...
2025-03-14
0
19
题解 | 坐标移动
8说了,浅浅压一压行[doge] pos = [0,0] for op in input().split(';'): if op and op[0] in ['A','S','W','D'] and op[1:].isdigit() and 0 < int(op[1:]) < 1...
2025-03-14
0
19
题解 | 句子逆序
Python的精髓就是在压行罢(乐) print(' '.join(input().split()[::-1])) #牛客春招刷题训练营# + 链接
2025-03-14
0
19
题解 | 合并表记录
需要注意Python不会像cpp的map一样自动初始化未被访问过的元素。 n = int(input()) dic = {} for _ in range(n): x,y = list(map(int,input().split())) dic[x] = dic.get(x,0) +...
2025-03-14
0
23
题解 | 质数因子
2e8 数据量理论上可以在线性时间通过,下面的代码在Python3 超时, 但是如果使用PyPy3就可以通过。 n = int(input()) pr = 2 while n != 1: while n % pr == 0: n //= pr print(pr...
2025-03-14
0
19
题解 | 字符个数统计
经典python压行 [doge] 用set就直接好力! print(len(set(input()))) #牛客春招刷题训练营# + 链接
2025-03-14
0
27
题解 | 进制转换
#牛客春招刷题训练营# + 链接一个Python有趣的解AWA print(eval(input()))
2025-03-14
0
21
首页
上一页
1
2
下一页
末页