結果

問題 No.805 UMG
ユーザー toshiro_yanagi
提出日時 2020-07-12 13:20:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 64,284 KB
最終ジャッジ日時 2024-11-18 14:04:58
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
cnt = 0

for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k >= n: break
        if s[i] != "U": continue
        if s[j] != "M": continue
        if s[k] != "G": continue
    
        cnt += 1

print(cnt)
0