CARLJOSEPHLEE
CARLJOSEPHLEE
全部文章
分类
题解(26)
归档
标签
去牛客网
登录
/
注册
CARLJOSEPHLEE的博客
全部文章
(共209篇)
题解 | 变幻莫测
x,y = map(int,input().split()) if x==y: print(0) elif y==0: print(1) elif x==0: print(2) elif x+y==0: print(3) else: print(-1)
2025-07-13
1
32
题解 | 魔法棒
这样应该是性能拉满了 from sys import stdin,stdout input() stdout.write("\n".join(["No" if i in {"2", "3", "5",...
2025-07-13
1
29
题解 | 魔法棒
本蒟蒻只会打表 for _ in range(int(input())): print("Yes" if int(input()) not in {2,3,5,6,8,11,14} else "No")
2025-07-13
1
22
题解 | 小红的字符串修改
我还以为是力扣那个经典的编辑距离,结果是个暴力枚举 s1 = [ord(i) for i in input().strip()] s2 = [ord(i) for i in input().strip()] n1,n2 = len(s1),len(s2) tempmin = 9999999999 f...
2025-07-13
2
36
题解 | 穷哈哈~
好久没写模拟题,WA了好多发qwq from sys import stdin read1 = stdin.read().split() n = int(read1[0]) str1 = read1[1] index = 0 tempmax = 0 pre = None templen = 0 wh...
2025-07-13
0
28
题解 | 买橘子
懒得滚动数组优化了 n = int(input()) dp = [999999]*(n+100) dp[6] = dp[8] = 1 for i in range(9,n+1): dp[i] = min(dp[i-6],dp[i-8]) if dp[i] != 999999: ...
2025-07-13
1
20
题解 | 田忌赛马
有趣的思维题,排序后遍历一遍田忌的马即可,贪心算法,始终让刚好能跑赢齐王的马上场:) l1 = list(sorted(list(map(int,input().split())))) l2 = list(sorted(list(map(int,input().split())))) cnt = 0...
2025-07-13
2
35
题解 | 小红喜欢1
l = [int(i) for i in input().split()] index = 0 while l[index] != 1: index += 1 print(index+1)
2025-07-13
1
21
题解 | 称砝码
n = int(input()) weights = [int(i) for i in input().split()] nums = [int(i) for i in input().split()] set1 = set() set1.add(0) for i in range(n): ...
2025-03-11
0
252
题解 | 汽水瓶
while 1: n = int(input()) if n == 0: break cnt = 0 while n >= 3: cnt += n//3 n = n%3+n//3 if n == 2: ...
2025-03-11
0
207
首页
上一页
9
10
11
12
13
14
15
16
17
18
下一页
末页