lotusor
lotusor
全部文章
分类
归档
标签
去牛客网
登录
/
注册
lotusor的博客
全部文章
(共13篇)
题解 | 小红的数组清空
from collections import Counter n = int(input()) a = list(map(int,input().split())) a.sort() dic = Counter(a) k = -1 kv = -1 cnt = 0 for key,value in ...
2026-02-09
1
13
题解 | 简单的模拟题
n,m = map(int,input().split()) right = input() out = [] ans = -1 core = 100/n for _ in range(m): name = input() check = input() cnt = 0 ...
2026-02-08
0
16
题解 | AOE还是单体?
n,x = map(int,input().split()) a = list(map(int,input().split())) cnt = 0 a.sort() if x >= n : print(sum(a)) else : for i in range(n-x,n): ...
2026-02-05
0
26
题解 | 小红的口罩
这题可以使用内置库中的优先队列来解决,我们知道优先队列中heap[0]为最小值,并且只需初始化一次,我们只需要每次提取min再将min修改后放回即可,正好符合本题的要求,关于优先队列的知识大家可以自行了解 import heapq n,k = map(int,input().split()) lis...
2025-12-19
1
48
题解 | 括号的匹配
n = int(input()) dic0 = {"{":"}","[":"]","(":")","<":">"} dic1 =...
2025-12-18
0
43
题解 | 点击消除
s = input() stack = [] for i in s: if not stack : stack.append(i) else : if stack[-1] == i : stack.pop(-1) ...
2025-12-09
0
39
题解 | 小红的异或构造
n = int(input()) C = n+1 ans = [C ^ i for i in range(1, n + 1)] print(' '.join(map(str, ans))) 本题需要用到异或的数学性质,不难发现本题的构造可以改写为ai异或i = aj 异或j,这就表明数列的所有异或结...
2025-12-07
0
47
题解 | 构造序列
n,m = map(int,input().split()) if m==n: print(m*2) elif m==0 or n==0: print(1) else : print(min(n,m)*2+1)
2025-12-06
0
41
题解 | 如果直接枚举所有的肯定会超时,所以要先预处理记录#的位置
n = int(input()) list0 = [list(input().strip()) for _ in range(n)] # 收集所有#的位置 points = [] for i in range(n): for j in range(n): if list0[i...
2025-12-06
0
41
题解 | 简单的常规模拟
n = int(input()) s = input().split() new = "" for i in range(len(s)): if s[i] == "0" : continue else : p =...
2025-12-06
0
36
首页
上一页
1
2
下一页
末页