結果

問題 No.805 UMG
ユーザー convexineq
提出日時 2021-04-06 08:16:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 64,404 KB
最終ジャッジ日時 2024-11-18 14:10:25
合計ジャッジ時間 2,570 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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