lotusor
lotusor
全部文章
分类
归档
标签
去牛客网
登录
/
注册
lotusor的博客
全部文章
(共21篇)
题解 | 纪年
import sys input = lambda :sys.stdin.read().strip() check = list(map(int,input().split())) for n in check : l,r = 5,11 print(((n-2018+l)%10+9)...
2026-05-14
0
6
题解 | 小红的矩阵染色
排序尽可能在染色所有列中比较长的"o"段,每次染色计分可以染色的个数-1 n,m,k = map(int,input().split()) maps = [""]*m ans=0 for _ in range(n): map = input() ...
2026-05-07
1
15
题解 | 分解质因数
依旧质数的基本性质,枚举试除就行 n= int(input()) ans = [] for i in range(2,int(n**0.5)+1): if n % i == 0 : while n % i == 0 : n //= i ...
2026-05-06
1
18
题解 | 法法
注意到和的奇偶性 = 奇数结果的个数的奇偶性,又因奇数个数S(n)≡m⋅(n−1)!(mod2)(其中 m=⌊(n+1)/2⌋),则当n>3时输出一定是0 t = int(input()) for _ in range(t): n = int(input()) print(1 ...
2026-05-05
1
21
题解 | 操作数组
操作都是一加一减,所以初始值一定要相同,加多少减多少只需要记住总共需要加或减多少就行了 n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) if sum(a) != sum(b)...
2026-05-04
1
21
题解 | 穷哈哈~
简单贪心就行,我们用k维护上一个读取的符合题意的字符,设其初始状态为0,用cnt存储当前能匹配到的最大值,当符合匹配规则时,cnt++,当不符合匹配规则时,重置cnt状态,用maxn存储总体最大值并时刻更新python代码如下 import sys n = int(input()) input = ...
2026-04-20
0
25
题解 | 区间增量与区间小于计数
这题数据拉了喵,所以能二重循环暴力喵,优化下输入即可喵( """ Hala Madrid! https://github.com/USYDDonghaoLi/Programming_Competition """ import sys ...
2026-03-23
0
67
题解 | 01序列
非常简单且经典的贪心 m = int(input()) a = input().split("1") n = int(input()) ans = 0 for i in a : k = i.count("0") ans += (k+1)//2 ...
2026-02-21
0
87
题解 | 小红的数组清空
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
83
题解 | 简单的模拟题
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
92
首页
上一页
1
2
3
下一页
末页