結果

問題 No.805 UMG
ユーザー nadeshino
提出日時 2020-05-19 18:37:33
言語 Nim
(2.2.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 3,073 ms
コンパイル使用メモリ 65,232 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 14:01:37
合計ジャッジ時間 3,932 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils
 
let read* = iterator: string =
  while true: (for s in stdin.readLine.split: yield s)
 
template input*(T: static[typedesc]): untyped = 
  when T is int: read().parseInt
  elif T is float: read().parseFloat
  elif T is string: read()
  elif T is char: read()[0]

let N = input(int)
let S = "#" & input(string)
var res = 0
for i in 1 .. N:
  if S[i] == 'M':
    for j in 1 .. N:
      if 1 <= i - j and i + j <= N:
        if S[i - j] == 'U' and S[i + j] == 'G':
          inc res
      else:
        break
echo res
0