結果

問題 No.790 ちきんの括弧並べ
ユーザー むらため
提出日時 2019-05-20 04:33:09
言語 Nim
(2.2.8)
コンパイル:
nim --nimcache=~ --hints:off -o:a.out -d:release cpp _filename_
実行:
./a.out
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 433 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,644 ms
コンパイル使用メモリ 68,316 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-23 05:26:51
合計ジャッジ時間 2,361 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #
raw source code

import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord
let n = scan()
proc solve(x,y:int):int = # x:( , y:)
  if x == n and y == n : return 1
  if x > n or y > n : return 0
  if x < y : return 0
  return solve(x+1,y) + solve(x,y+1)
echo solve(0,0)
0