結果

問題 No.805 UMG
ユーザー lumefflux
提出日時 2019-03-23 00:56:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 64,356 KB
最終ジャッジ日時 2024-11-18 13:30:02
合計ジャッジ時間 2,384 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
cnt = 0
for i in range(N):
    if S[i] != 'U':
        continue
    K = (N - i - 1) // 2
    for j in range(K + 1):
        if S[i + j] == 'M' and S[i + 2 * j] == 'G':
            cnt += 1
print(cnt)
0