爱读书的菠萝蜜很想去杭州
爱读书的菠萝蜜很想去杭州
全部文章
分类
归档
标签
去牛客网
登录
/
注册
爱读书的菠萝蜜很想去杭州的博客
全部文章
(共45篇)
题解 | 岛屿数量
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 判断岛屿数量 # @param grid char字符型二维数组 # @return int整型 # class Solution: def solve(self, grid: List[List[st...
2025-07-05
0
7
题解 | 岛屿数量
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 判断岛屿数量 # @param grid char字符型二维数组 # @return int整型 # class Solution: def solve(self, grid: List[List[st...
2025-07-05
0
6
题解 | 【模板】单源最短路1
import sys import heapq n,m = map(int,input().split()) graph = [[] for _ in range(5001)] for _ in range(m): u,v = map(int,input().split()) gra...
2025-07-05
0
8
题解 | 走迷宫
import sys import heapq n, m = map(int, input().split()) xs, ys, xt, yt = map(int, input().split()) g = [['*'] for _ in range(n + 1)] # 索引0不使用 for i...
2025-07-05
0
7
题解 | 【模板】单源最短路1
import sys n,m = map(int,input().split()) graph = [[] for _ in range(5001)] for _ in range(m): u,v = map(int,input().split()) graph[u].append(...
2025-07-05
0
4
题解 | 相差不超过k的最多数
n,k = map(int,input().split()) a = list(map(int,input().split())) a.sort() left = 0 max_length = 0 for right in range(len(a)): while a[right] - a[...
2025-07-04
0
6
题解 | 哈夫曼编码
# 编码后字符串的长度等于原始的频率乘以编码长度再求和 import heapq n = int(input()) a = list(map(int, input().split())) heapq.heapify(a) total_length = 0 while len(a)>1: ...
2025-07-04
0
6
题解 | 快速幂
q = int(input()) # 补充余数运算性质 # (a*b) mod p = [(a mod p)*(b mod p)] mod p def function1(a,b,p): if b == 0: return 1 if b%2 == 1: res = f...
2025-07-04
0
7
题解 | 汉诺塔问题
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param n int整型 # @return string字符串一维数组 # class Solution: def getSolution(self , n: int) -> Lis...
2025-07-04
0
8
题解 | 二分查找-I
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param nums int整型一维数组 # @param target int整型 # @return int整型 # 二分查找方法 class Solution: def search(...
2025-07-04
0
7
首页
上一页
1
2
3
4
5
下一页
末页