6 条题解
-
-2
既然都用数组,那我大python的字典直接申请出战
Python
n: int a: int b: int n, a, b = map(int, input().split()) clothes: dict = {} # 使用字典来存储衣服湿度信息 R: int = 0 for _ in range(n): w_i: int = int(input()) - 1 clothes[w_i] = clothes.get(w_i, 0) + 1 # 更新字典中的衣服湿度信息 R = max(R, w_i) tot_time: int = 0 L: int = 0 while L <= R: if R in clothes: clothes[R] -= 1 if R - b >= 0: clothes[R - b] = clothes.get(R - b, 0) + 1 while L <= R and (R not in clothes or clothes[R] <= 0): # 处理湿度为0的衣服 R -= 1 L += a tot_time += 1 print(tot_time)
信息
- ID
- 936
- 时间
- 3000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- 递交数
- 576
- 已通过
- 38
- 上传者