結果
問題 | No.805 UMG |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:02:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 152 ms / 2,000 ms |
コード長 | 294 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,644 KB |
実行使用メモリ | 65,204 KB |
最終ジャッジ日時 | 2025-03-20 21:02:04 |
合計ジャッジ時間 | 3,040 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
n = int(input())s = input().strip()count = 0max_d = (n - 1) // 2for d in range(1, max_d + 1):max_i = n - 2 * dfor i in range(1, max_i + 1):j = i + dk = i + 2 * dif s[i-1] == 'U' and s[j-1] == 'M' and s[k-1] == 'G':count += 1print(count)