papybara
papybara
全部文章
分类
题解(1)
归档
标签
去牛客网
登录
/
注册
papybara的博客
全部文章
(共20篇)
题解 | 走迷宫
from collections import deque # 输入数据 n, m = map(int, input().split()) xs, ys, xt, yt = map(int, input().split()) # 读入地图(转为字符列表) grid = [list(input()...
2025-08-26
0
11
题解 | 走迷宫
from collections import deque n,m = map(int,input().split()) xs,ys,xt,yt = map(int,input().split()) grid = [list(input().strip()) for _ in range(n)] #...
2025-08-26
0
11
题解 | 数水坑
import sys n,m = map(int,input().split()) puddle = 0 grid = [list(sys.stdin.readline().strip()) for _ in range(n) ] visited = [[False]*m for _ in rang...
2025-08-24
0
10
题解 | 小红的字符串
s = input().strip() res,a,b =0,0,len(s)-1 # 双指针,共同向中间逼近 while b>a: delta = abs(ord(s[a])-ord(s[b])) res += min(delta,26-delta) # 取(a增加到b,a...
2025-08-20
0
18
题解 | 清楚姐姐买竹鼠
a,b,x = map(int,input().split()) if 3*a>b: quotient,remainder = divmod(x,3) res = b*quotient+a*remainder # 尽量买3的倍数,剩下的单买 res2 = b*(quot...
2025-08-20
0
15
题解 | 迷宫寻路
n,m = map(int,input().split()) desk = [list(input().strip()) for _ in range(n)] x,y = 0,0 pos = [(0,0)] dirs = [(1,0),(0,1),(-1,0),(0,-1)] while True...
2025-08-19
1
16
题解 | 分数线划定
import sys n,m = map(int,sys.stdin.readline().split()) l = [list(map(int,sys.stdin.readline().split())) for _ in range(n)] t = int(1.5*m) l.sort(key=l...
2025-08-18
1
14
题解 | 购物单
import sys budget,s = map(int,input().split()) desk = [list(map(int,line.split())) for line in sys.stdin] # 构建新列表,取附件的情况 primary={} # 表结构 # primary={...
2025-08-17
0
14
题解 | 宝石手串
import sys def brokeWristband(n:int,lis:list): searched=set() #集合,用于记录已经反向查找过的字母 minl = n if len(set(lis))==n:return -1 #无重复则返回-1 for...
2025-08-13
0
16
题解 | #称砝码#
import sys i = int(sys.stdin.readline()) m = list(map(int,sys.stdin.readline().split())) n = list(map(int,sys.stdin.readline().split())) 构造全列表 weight ...
Python3
2025-08-10
0
21
首页
上一页
1
2
下一页
末页