牛客242693846号
牛客242693846号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客242693846号的博客
全部文章
(共30篇)
题解 | 挡住洪水
感觉题目有歧义....是统计不会被淹的0的数量不是区域的数量。 from collections import deque def in_bound(x, y, n, m): return 0 <= x < n and 0 <= y < m n, m = map...
2025-07-25
1
27
题解 | 取数游戏
dx = [-1,-1,-1,0,0,1,1,1] dy = [-1,0,1,-1,1,-1,0,1] def in_bound(x:int, y:int, N:int, M:int): return 0 <= x < N and 0 <= y < M def d...
2025-07-24
0
34
题解 | 中位数之和
思路是先对二进制序列进行排序,然后计算每个元素被选做中位数的次数,将次数乘元素值进行求和。次数的计算,则是考虑从该元素的左右各选择m个数,m=(k-1)//2,左边记为left,右边记为right。总共就有left*right种可能,也就是会被选中这么多次。 MOD = 10**9 + 7 MAXN...
2025-07-23
0
26
题解 | 元素方碑
n = int(input()) for _ in range(n): m = int(input()) ls = list(map(int,input().split())) if len(ls)>1: a = ls[::2] b = ...
2025-07-14
0
29
题解 | 插队
n, m = map(int, input().split()) ls = input().split() # 维护前后关系,双向链表结构 prev = {} next = {} for i in range(n): if i > 0: prev[ls[i]] = ...
2025-07-11
0
22
题解 | 明天星期几?
map = [1,2,3,4,5,6,7,1] print(map[int(input())])
2025-07-08
0
35
题解 | #数据分类处理#
order1 = list(map(int,input().split()[1:])) order2 = list(map(int,input().split()[1:])) order2_new = [] #order2去重 for&nb...
数组
字符串
2022-09-21
0
285
题解 | #自动售货系统#
pricedict = {"A1":2,"A2":3,"A3":4,"A4":5,"A5":8,"A6":6} mountdict = {"A1":0,"A2":0,"A3":0,"A4":0,"A5":0,"A6":0} moneybox =&nb...
Python3
数组
字符串
设计
2022-09-21
0
313
题解 | #矩阵乘法计算量估算#
def calmul(a,b,c,d): return a*b*d num = int(input()) matrixs = [] for i in range(...
Python3
数组
栈
2022-09-20
0
341
题解 | #识别有效的IP地址和掩码并进行分类统计#
def iswrongyan(ip2): index = [0 for x in range(32)] for i ...
Python3
字符串
数组
2022-09-19
0
397
首页
上一页
1
2
3
下一页
末页