結果
| 問題 | 
                            No.805 UMG
                             | 
                    
| コンテスト | |
| ユーザー | 
                             iad_2889
                         | 
                    
| 提出日時 | 2019-05-09 06:11:22 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 331 bytes | 
| コンパイル時間 | 173 ms | 
| コンパイル使用メモリ | 82,376 KB | 
| 実行使用メモリ | 135,220 KB | 
| 最終ジャッジ日時 | 2024-11-18 13:49:15 | 
| 合計ジャッジ時間 | 17,129 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 TLE * 5 | 
ソースコード
N = int(input())
S = input()
count = 0
for i in range(N - 2):
    if S[i] != "U":
        continue
    for j in range(i + 1,N - 1):
        if S[j] != "M":
            continue
        for k in range(j + 1,N):
            if j - i != k - j:
                continue
            if S[k] == "G":
                count+=1
print(count)
            
            
            
        
            
iad_2889