結果

問題 No.805 UMG
ユーザー daku9640daku9640
提出日時 2019-03-22 23:11:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 76,612 KB
最終ジャッジ日時 2023-08-11 19:19:57
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,268 KB
testcase_01 AC 76 ms
71,288 KB
testcase_02 AC 75 ms
71,276 KB
testcase_03 AC 73 ms
70,972 KB
testcase_04 AC 73 ms
71,296 KB
testcase_05 AC 73 ms
71,148 KB
testcase_06 AC 74 ms
71,144 KB
testcase_07 AC 76 ms
71,168 KB
testcase_08 AC 73 ms
71,308 KB
testcase_09 AC 75 ms
70,988 KB
testcase_10 AC 74 ms
71,180 KB
testcase_11 AC 75 ms
70,976 KB
testcase_12 AC 74 ms
71,440 KB
testcase_13 AC 77 ms
71,136 KB
testcase_14 AC 74 ms
71,216 KB
testcase_15 AC 84 ms
76,128 KB
testcase_16 AC 86 ms
76,008 KB
testcase_17 AC 82 ms
75,884 KB
testcase_18 AC 86 ms
75,920 KB
testcase_19 AC 78 ms
75,488 KB
testcase_20 AC 83 ms
75,856 KB
testcase_21 AC 80 ms
75,648 KB
testcase_22 AC 85 ms
75,816 KB
testcase_23 AC 117 ms
76,612 KB
testcase_24 AC 115 ms
76,500 KB
testcase_25 AC 116 ms
76,456 KB
testcase_26 AC 115 ms
76,592 KB
testcase_27 AC 119 ms
76,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
ans = 0
for i in range(n - 2):
    if s[i] == 'U':
        try:
            for k in range(1, (n - i) // 2 + 1):
                if s[i + k] == 'M' and s[i + k * 2] == 'G':
                    ans += 1
        except:
            err = 1
print(ans)
0