結果

問題 No.805 UMG
ユーザー stngstng
提出日時 2022-07-02 17:31:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 76,264 KB
最終ジャッジ日時 2023-08-11 20:02:50
合計ジャッジ時間 3,881 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,416 KB
testcase_01 AC 73 ms
71,236 KB
testcase_02 AC 72 ms
71,292 KB
testcase_03 AC 73 ms
71,236 KB
testcase_04 AC 73 ms
71,196 KB
testcase_05 AC 72 ms
71,328 KB
testcase_06 AC 72 ms
71,036 KB
testcase_07 AC 73 ms
71,212 KB
testcase_08 AC 72 ms
71,256 KB
testcase_09 AC 72 ms
71,512 KB
testcase_10 AC 72 ms
71,320 KB
testcase_11 AC 73 ms
71,232 KB
testcase_12 AC 73 ms
71,376 KB
testcase_13 AC 73 ms
71,152 KB
testcase_14 AC 73 ms
71,208 KB
testcase_15 AC 80 ms
76,200 KB
testcase_16 AC 80 ms
75,828 KB
testcase_17 AC 81 ms
75,772 KB
testcase_18 AC 83 ms
75,780 KB
testcase_19 AC 81 ms
75,720 KB
testcase_20 AC 81 ms
75,784 KB
testcase_21 AC 81 ms
75,932 KB
testcase_22 AC 83 ms
75,752 KB
testcase_23 AC 110 ms
76,264 KB
testcase_24 AC 112 ms
76,216 KB
testcase_25 AC 114 ms
76,244 KB
testcase_26 AC 114 ms
75,876 KB
testcase_27 AC 113 ms
76,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0

for i in range(n):
    if s[i] == "U":
        for j in range(1,n//2+1):
            if i+j*2 >= n:
                break
            if s[i+j] == "M" and s[i+j*2] == "G":
                ans += 1

print(ans)
0