結果
| 問題 |
No.996 Phnom Penh
|
| コンテスト | |
| ユーザー |
chinchilla
|
| 提出日時 | 2020-02-22 02:07:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 2,000 ms |
| コード長 | 295 bytes |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 15,760 KB |
| 最終ジャッジ日時 | 2024-10-09 10:56:22 |
| 合計ジャッジ時間 | 2,272 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
import re
s = input()
tt = s.maketrans({'h':None, 'e':'h'})
r = 0
i = 2
while i and ('h' in s or 'e' in s):
r += s.count('phnom') + 1
s = s.replace('phnom', 'penh').translate(tt)
i -= 1
m = [len(f[0])//2 for f in re.findall('(?<=phn)((om)*)', s)]
r += sum(m) + max(m) + 1 if m else 0
print(r)
chinchilla