結果

問題 No.805 UMG
ユーザー mlihua09mlihua09
提出日時 2020-08-28 20:55:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 76,632 KB
最終ジャッジ日時 2023-08-11 19:55:11
合計ジャッジ時間 3,882 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,188 KB
testcase_01 AC 74 ms
75,716 KB
testcase_02 AC 71 ms
71,428 KB
testcase_03 AC 74 ms
75,568 KB
testcase_04 AC 70 ms
71,428 KB
testcase_05 AC 72 ms
71,240 KB
testcase_06 AC 72 ms
71,416 KB
testcase_07 AC 71 ms
71,336 KB
testcase_08 AC 70 ms
71,164 KB
testcase_09 AC 69 ms
71,540 KB
testcase_10 AC 71 ms
71,172 KB
testcase_11 AC 73 ms
71,188 KB
testcase_12 AC 71 ms
71,240 KB
testcase_13 AC 72 ms
71,388 KB
testcase_14 AC 71 ms
71,260 KB
testcase_15 AC 78 ms
75,860 KB
testcase_16 AC 79 ms
76,336 KB
testcase_17 AC 75 ms
75,828 KB
testcase_18 AC 78 ms
75,972 KB
testcase_19 AC 75 ms
75,700 KB
testcase_20 AC 77 ms
75,676 KB
testcase_21 AC 77 ms
76,300 KB
testcase_22 AC 81 ms
76,388 KB
testcase_23 AC 118 ms
76,632 KB
testcase_24 AC 106 ms
76,228 KB
testcase_25 AC 108 ms
76,424 KB
testcase_26 AC 110 ms
76,348 KB
testcase_27 AC 109 ms
76,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


N = int(input())

S = input()

ans = 0

for i in range(N):
    
    if S[i] == 'M':
        
        for j in range(1, min(i, N - i - 1) + 1):
            
            if S[i - j] == 'U' and S[i + j] == 'G':
                
                ans += 1
                
                
print(ans)
0