結果

問題 No.805 UMG
ユーザー c-yanc-yan
提出日時 2020-08-07 23:30:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 20,992 KB
最終ジャッジ日時 2024-04-29 11:11:23
合計ジャッジ時間 8,860 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
20,992 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 32 ms
10,624 KB
testcase_03 AC 32 ms
10,624 KB
testcase_04 AC 31 ms
10,496 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 31 ms
10,496 KB
testcase_07 AC 32 ms
10,624 KB
testcase_08 AC 36 ms
10,624 KB
testcase_09 AC 33 ms
10,624 KB
testcase_10 AC 31 ms
10,624 KB
testcase_11 AC 32 ms
10,624 KB
testcase_12 AC 31 ms
10,624 KB
testcase_13 AC 34 ms
10,624 KB
testcase_14 AC 31 ms
10,496 KB
testcase_15 TLE -
testcase_16 AC 1,575 ms
10,624 KB
testcase_17 AC 875 ms
10,496 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

result = 0
i = -1
while i < N:
    i = S.find('U', i + 1)
    if i == -1:
        break
    j = i
    while j < N:
        j = S.find('M', j + 1)
        if j == -1:
            break
        k = j
        while k < N:
            k = S.find('G', k + 1)
            if k == -1:
                break
            if j - i != k - j:
                continue
            result += 1
            #print(i, j, k)
print(result)
0