結果
問題 |
No.2298 yukicounter
|
ユーザー |
![]() |
提出日時 | 2023-05-12 21:27:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 1,098 bytes |
コンパイル時間 | 917 ms |
コンパイル使用メモリ | 82,456 KB |
実行使用メモリ | 65,120 KB |
最終ジャッジ日時 | 2024-11-28 17:18:18 |
合計ジャッジ時間 | 3,075 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1") # from bisect import * # from collections import * # from heapq import * # from itertools import * # from math import * # from datetime import * # from decimal import* # from string import ascii_lowercase,ascii_uppercase # import numpy as np import sys import os # sys.setrecursionlimit(10**6) INF = 10**18 MOD = 998244353 # MOD = 10**9 + 7 File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdin def input(): return File.readline()[:-1] # /////////////////////////////////////////////////////////////////////////// S = input() S = S.replace("yukicoder", "0") def count_max_char(s, c): """ 文字列sに含まれる文字cの最大連続数を返す関数 s: 文字列 c: 検索する文字 """ count = 0 max_count = 0 for i in range(len(s)): if s[i] == c: count += 1 else: max_count = max(max_count, count) count = 0 max_count = max(max_count, count) return max_count cnt = count_max_char(S, "0") print(cnt)