牛客242693846号
牛客242693846号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客242693846号的博客
全部文章
(共30篇)
题解 | 因数博弈
观察出来的,将这个数进行质因数分解。如果分解出来的数量是2个,例如4=2*2,6=2*3。那么就是Bob获胜,其余情况则是Alice获胜。 def prime_factors(n): factors = [] x = n i = 2 while i * i <=...
2025-08-06
0
16
题解 | 破壁
n, x, y = map(int,input().split()) A = list(map(int,input().split())) if x > y: print(n) else: cnt = 0 for e in A: if e <= x...
2025-08-06
0
14
题解 | 浮木博弈
游戏的胜负取决于第一个至少有2张全家福的堆的位置。 T = int(input()) for _ in range(T): n = int(input()) A = list(map(int,input().split())) for i in range(n): ...
2025-08-06
0
14
题解 | 绝对值博弈
最终这个集合会演化为一个“差为 d 的等差数列”,其中 d=gcd(A),最大值是原来集合中的最大值。因此操作步骤就是:1、求出原集合的最大公约数g,和现在的最大数max(A)2、计算理论上这个集合能包含多少数max(A)//g3、计算现有数和能包含的数之间的差值added4、根据added的奇偶...
2025-08-06
0
20
题解 | 删得回文串
from collections import Counter s = input().strip() counter = Counter(s) # 统计出现奇数次的字符数量 odd_count = sum(1 for count in counter.values() if count % 2...
2025-08-06
0
11
题解 | 山峰数组计数
import bisect n = int(input()) nums = list(map(int, input().split())) # 构建前缀和 sum_nums = [0] for num in nums: sum_nums.append(sum_nums[-1] + num...
2025-07-31
0
20
题解 | 小红的矩阵
def count_le(x): # 统计乘法表中小于等于x的个数 # 对于每一行,要有j * i ≤ x ⇒ j ≤ x // i,同时最多有m列 return sum(min(m, x // i) for i in range(1, n + 1)) def b...
2025-07-31
0
20
题解 | [CQOI2010]扑克牌
def judge(x, a, n, m): # 判断能否组成 x 套牌 need = 0 for i in range(n): if x > a[i]: need += x - a[i] # 需要用 Joker 补的张数 ...
2025-07-31
0
15
题解 | 圆覆盖
from math import sqrt import bisect n, S = map(int, input().split()) points = [list(map(int, input().split())) for _ in range(n)] # 按到原点的距离排序 point...
2025-07-31
0
15
题解 | 音符
import bisect n,q = map(int,input().split()) b = list(map(int,input().split())) t = list(map(int,input().split())) # 计算每个音符的起始时刻 music = [0]*(n) for...
2025-07-31
0
16
首页
上一页
1
2
3
下一页
末页