4 条题解
题解与来源题共享。已有题解默认通过;新增或编辑后需由来源域管理员审核。待审核、驳回题解仅作者和审核管理员可见。来源域:system
-
0
import sys input = lambda:sys.stdin.readline().strip() s = input() k = int(input()) n = len(s) left = 0 from collections import defaultdict count = defaultdict(int) res = 0 for right in range(n): count[s[right]] += 1 while count[s[right]] > k: count[s[left]] -= 1 left += 1 res += (right - left + 1) print(res)
信息
- ID
- 679
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 普及
- 标签
- 递交数
- 235
- 已通过
- 92
- 上传者