何成95
何成95
全部文章
分类
归档
标签
去牛客网
登录
/
注册
何成95的博客
全部文章
(共206篇)
题解 | 卡拉兹函数
n = int(input()) print(3*n+1 if n%2==1 else int(n/2))
2025-08-28
0
25
题解 | 判断闰年
n = int(input()) print('yes' if n%400==0 or n%4==0 and n%100!=0 else 'no')
2025-08-28
0
25
题解 | 求四位数各个数位之和
print(sum(map(int,list(input()))))
2025-08-28
0
21
题解 | 小红的魔法药剂
n = int(input()) a = list(map(int,input().split())) bc = [list(map(int,input().split())) for _ in range(n)] ans = 0#总花费 for i in range(n):#循环n次,直接购买该...
2025-08-28
0
24
题解 | 排座椅
n, m, k, l, d = map(int,input().split())#输入相关参数 clmt = [list(map(int,input().split())) for _ in range(d)]#输入交头接耳同学的位置 a, b = dict(), dict() for x,y,p...
2025-08-28
0
22
题解 | 01序列
m = int(input()) s = input() n = int(input()) can = [int(len(x)/2) for x in s.replace(' ','').split('1') if x!=''] print('true' if sum(can)>=n else...
2025-08-28
0
32
题解 | 灵异背包?
n = int(input()) a = list(map(int,input().split())) s = sum(a)#先计算数组的和 if s%2==1:#如果数组的和为奇数,则删除当前数组中最小的奇数 for c in sorted(a): if c%2==1: ...
2025-08-27
0
30
题解 | 小红的字符串
s = input() ans, n, l, r = 0, len(s), 0, len(s)-1 while l < r:#采用双指针法,两端指针向内靠拢 dis = abs(ord(s[l]) - ord(s[r])) ans += min(dis, 26 - dis)#寻...
2025-08-27
0
17
题解 | 清楚姐姐买竹鼠
a, b, x = map(int, input().split()) if b / 3 >= a:#购买三只比单独购买一只无优惠,甚至价格更贵时 print(a * x) elif b <= a:#购买三只的价格不超过购买一只时 if x % 3 == 0:#需要购买的...
2025-08-27
0
26
题解 | 讨厌鬼进货
n, x = map(int,input().split()) a = list(map(int,input().split())) b = list(map(int,input().split())) fee = 0 for i in range(n):#寻找购买第i件商品的最低价 fee...
2025-08-27
0
17
首页
上一页
7
8
9
10
11
12
13
14
15
16
下一页
末页