結果

問題 No.805 UMG
ユーザー gorugo30
提出日時 2021-02-24 20:07:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 64,896 KB
最終ジャッジ日時 2024-11-18 14:09:37
合計ジャッジ時間 3,002 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
ans = 0
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        k = 2 * j - i
        if not(j < k <= N):
            continue
        if S[i - 1] == "U" and S[j - 1] == "M" and S[k - 1] == "G":
            ans += 1
print(ans)
0