結果

問題 No.805 UMG
ユーザー gma712gma712
提出日時 2019-03-26 15:19:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 77,040 KB
最終ジャッジ日時 2023-08-11 19:27:52
合計ジャッジ時間 3,940 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,564 KB
testcase_01 AC 74 ms
75,224 KB
testcase_02 AC 68 ms
71,452 KB
testcase_03 AC 72 ms
75,284 KB
testcase_04 AC 70 ms
71,388 KB
testcase_05 AC 69 ms
71,260 KB
testcase_06 AC 73 ms
71,472 KB
testcase_07 AC 70 ms
71,256 KB
testcase_08 AC 71 ms
75,504 KB
testcase_09 AC 72 ms
75,224 KB
testcase_10 AC 68 ms
71,392 KB
testcase_11 AC 72 ms
71,184 KB
testcase_12 AC 68 ms
71,188 KB
testcase_13 AC 73 ms
75,476 KB
testcase_14 AC 69 ms
71,392 KB
testcase_15 AC 79 ms
75,464 KB
testcase_16 AC 79 ms
76,188 KB
testcase_17 AC 77 ms
75,504 KB
testcase_18 AC 80 ms
75,524 KB
testcase_19 AC 78 ms
75,524 KB
testcase_20 AC 78 ms
75,536 KB
testcase_21 AC 76 ms
75,716 KB
testcase_22 AC 79 ms
75,324 KB
testcase_23 AC 143 ms
76,764 KB
testcase_24 AC 141 ms
76,848 KB
testcase_25 AC 144 ms
76,840 KB
testcase_26 AC 141 ms
76,772 KB
testcase_27 AC 145 ms
77,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8


def main():
    n = int(input())
    s = list(input())
    a = 0
    for i in range(1, n):
        if s[i] != 'M':
            continue
        else:
            for j in range(i):
                if s[j] != 'U':
                    continue
                else:
                    if 2 * i - j >= n:
                        continue
                    else:
                        a += 1 if s[2 * i - j] == 'G' else 0
    print(a)


if __name__ == '__main__':
    main()
0