結果

問題 No.805 UMG
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-03-23 09:01:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 76,768 KB
最終ジャッジ日時 2023-08-11 19:21:55
合計ジャッジ時間 4,207 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,788 KB
testcase_01 AC 75 ms
75,776 KB
testcase_02 AC 71 ms
71,152 KB
testcase_03 AC 73 ms
75,628 KB
testcase_04 AC 69 ms
71,248 KB
testcase_05 AC 69 ms
71,084 KB
testcase_06 AC 71 ms
71,460 KB
testcase_07 AC 73 ms
75,796 KB
testcase_08 AC 76 ms
75,720 KB
testcase_09 AC 75 ms
76,300 KB
testcase_10 AC 71 ms
71,468 KB
testcase_11 AC 69 ms
71,504 KB
testcase_12 AC 69 ms
71,368 KB
testcase_13 AC 74 ms
75,776 KB
testcase_14 AC 69 ms
70,940 KB
testcase_15 AC 81 ms
76,460 KB
testcase_16 AC 82 ms
76,536 KB
testcase_17 AC 79 ms
76,308 KB
testcase_18 AC 84 ms
76,612 KB
testcase_19 AC 81 ms
76,344 KB
testcase_20 AC 83 ms
76,472 KB
testcase_21 AC 81 ms
76,348 KB
testcase_22 AC 82 ms
76,016 KB
testcase_23 AC 173 ms
76,640 KB
testcase_24 AC 182 ms
76,768 KB
testcase_25 AC 171 ms
76,584 KB
testcase_26 AC 178 ms
76,436 KB
testcase_27 AC 179 ms
76,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()


ans = 0
for stride in range(1, N//2+1):
    for k in range(0+stride, N-stride+1):
        i = k - stride
        j = k + stride

        if j >= N:
            continue
        
        if S[i] == "U" and \
           S[k] == "M" and \
           S[j] == "G":
               ans += 1
print(ans)
0