何成HN
何成HN
全部文章
分类
归档
标签
去牛客网
登录
/
注册
何成HN的博客
全部文章
(共439篇)
题解 | 被打乱的异或和
t = int(input()) for _ in range(t): n = int(input())#输入数组为异或和,即eval('^'.join(nums))==0 nums = list(map(int,input().split())) print(nums[0]...
2025-10-25
0
50
题解 | 二进制不同位数
m, n = map(int,input().split()) print(bin(m^n).count('1'))#求异或,转为二进制,求1的数量,输出1的数量
2025-10-25
1
38
题解 | 二进制数1
print(bin(int(input())).count('1'))
2025-10-25
0
29
题解 | 数颜色
s = input() r, g, b =0, 0, 0 for c in s: if c=='R': r += 1 elif c=='G': g += 1 elif c=='B': b += 1 print(f'({r},...
2025-10-25
0
33
题解 | 买橘子
n = int(input()) def getresult(n): for i in range(n//6+1):#归买6个/袋的袋数 for j in range(n//8+1):#购买8个/袋的袋数 if 6*i+8*j==n:#累计购买总数 ...
2025-10-25
0
47
题解 | 田忌赛马
v = sorted(list(map(int,input().split())))#齐威王的马升序排列 a = sorted(list(map(int,input().split())))#田忌的马升序排列 a.append(a.pop(0))#田忌的最劣等马放到最后 ans = 0 for i...
2025-10-25
0
34
题解 | 小红喜欢1
print(list(map(int,input().split())).index(1)+1)
2025-10-25
0
38
题解 | 不重复数字
t = int(input()) for _ in range(t): n = int(input()) a = list(map(int,input().split())) seen, ans = set(), [] for c in a: if c...
2025-10-25
0
33
题解 | 宝石计数
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param jewels string字符串 # @param stones string字符串 # @return int整型 # class Solution: def numJewel...
2025-10-25
0
26
题解 | 表达式求值
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # 返回表达式的值 # @param s string字符串 待计算的表达式 # @return int整型 # class Solution: def solve(self , s: str) ->...
2025-10-25
0
26
首页
上一页
22
23
24
25
26
27
28
29
30
31
下一页
末页