結果

問題 No.805 UMG
ユーザー Woo-Cie
提出日時 2019-03-22 21:32:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 884 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-18 13:15:05
合計ジャッジ時間 6,082 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8-*-

n = int(input())
s = input()

a = 0

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

print(a)
0