牛客253847561号
牛客253847561号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客253847561号的博客
全部文章
(共41篇)
题解 | 数水坑
from collections import deque grid=[(-1,-1),(-1,0),(-1,1),(0,-1),(0,1),(1,-1),(1,0),(1,1)] m,n=map(int,input().split()) b=[input() for i in range(m)] ...
2026-04-30
0
9
题解 | 迷宫寻路
n,m=map(int,input().split()) l=[list(input()) for i in range(n)] x,y=0,0 p=[(1,0),(0,1),(-1,0),(0,-1)] pos=[(0,0)] while True: if x==n-1 and y==m-...
2026-04-17
0
13
题解 | 变幻莫测
a,b=map(int,input().split()) if a==0 and b!=0: print(2) elif a!=0 and b==0: print(1) elif a==b : print(0) elif a+b==0: print(3) else: ...
2026-04-08
0
22
题解 | 小红的正整数构造
import sys a,b,c=input().split() for i in range(int(a),int(b)+1): if i%int(c)==0: print(i) break else: print(-1)
2026-04-03
0
33
题解 | 小红喜欢1
import sys l=input().split() for i in l: if int(i)==1: print (l.index(i)+1)
2026-04-03
0
32
题解 | 二叉搜索树的最近公共祖先
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # 代码中的类名、方法名、参数名已经指定,请勿...
2026-04-03
0
29
题解 | 小苯的比赛上分
import heapq m,n=input().split() a=list(map(int,input().split())) b=list(map(int,input().split())) heapq.heapify(a) maxscore=max(a) for i in b: mi...
2026-03-20
0
36
题解 | 两端问优先队列
import heapq from collections import Counter n=int(input()) s=[] ms=[] count=Counter() for i in range(n): op=list(map(int,input().split())) if...
2026-03-19
0
39
题解 | 字符串优先队列
import heapq # 使用Python的heapq模块实现字典序最小的字符串堆 s = [] def insertValue(x): # TODO: 实现插入操作 heapq.heappush(s,x) pass def deleteValue(): h...
2026-03-19
0
44
题解 | 【模板】整数优先队列
import heapq n=int(input()) heap=[] for i in range(n): s=list(map(int,input().split())) if int(s[0])==1: heapq.heappush(heap,s[1]) ...
2026-03-18
0
36
首页
上一页
1
2
3
4
5
下一页
末页