結果

問題 No.805 UMG
ユーザー liny_tail
提出日時 2020-10-12 20:25:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 742 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-18 14:08:00
合計ジャッジ時間 5,762 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input().strip())
S = input().strip()

lst = []

n = 1
while True:
  if n*2 >= N:
    break
  
  lst.append([n, n*2])
  
  n += 1

cnt = 0

for i in range(N-2):
  if S[i] != 'U':
    continue
  
  for j in lst:
    if j[1] + i >= N:
      break
    
    if S[j[0]+i] == 'M':
      if S[j[1]+i] == 'G':
        cnt += 1

print(cnt)
0