結果

問題 No.805 UMG
ユーザー ohana
提出日時 2023-10-30 15:02:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,494 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-25 17:16:03
合計ジャッジ時間 9,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
S = list(input())

cnt = 0

for i in range(n):
    if S[i] == "M":
        for j in range(i):
            if 2 * i - j < n and (S[j], S[2 * i - j]) == ("U", "G"):
                cnt += 1

print(cnt)
0