結果

問題 No.805 UMG
ユーザー stng
提出日時 2022-07-02 17:31:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 63,760 KB
最終ジャッジ日時 2024-11-18 14:15:24
合計ジャッジ時間 2,353 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()

ans = 0

for i in range(n):
    if s[i] == "U":
        for j in range(1,n//2+1):
            if i+j*2 >= n:
                break
            if s[i+j] == "M" and s[i+j*2] == "G":
                ans += 1

print(ans)
0