結果

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

ソースコード

diff #

n = int(input())
s = input()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if j + (j - i) >= n:
            break
        if s[i] == "U" and s[j] == "M" and s[j + j - i] == "G":
            ans += 1
print(ans)
0