lotusor
lotusor
全部文章
分类
归档
标签
去牛客网
登录
/
注册
lotusor的博客
全部文章
(共8篇)
题解 | 点击消除
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
5
题解 | 小红的异或构造
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
12
题解 | 构造序列
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
9
题解 | 如果直接枚举所有的肯定会超时,所以要先预处理记录#的位置
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
8
题解 | 简单的常规模拟
n = int(input()) s = input().split() new = "" for i in range(len(s)): if s[i] == "0" : continue else : p =...
2025-12-06
0
8
题解 | 铺地毯
import sys n = int(input()) list0 = [list(map(int, input().split())) for i in range(n)] x,y = map(int, input().split()) t = -1 for j in range(n): ...
2025-12-02
0
9
题解 | 排序危机之利用py的异常机制的一个很邪门的解法
#很不推荐大家在正赛用try,有点不规范,但可以开阔下思路( a = int(input()) n = input() low = "" up = "" num = "" for i in n: try : p = ...
2025-12-02
1
11
题解 | 添加逗号
n = input() m = n[::-1] count = 0 s = "" for i in m: count += 1 if count % 3 == 0 and count != len(m): s += i + ","...
2025-12-02
0
10