結果

問題 No.420 mod2漸化式
コンテスト
ユーザー keiden
提出日時 2024-09-22 16:24:07
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
AC  
実行時間 51 ms / 1,000 ms
コード長 408 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 160 ms
コンパイル使用メモリ 6,528 KB
実行使用メモリ 22,784 KB
最終ジャッジ日時 2026-04-10 23:00:18
合計ジャッジ時間 3,220 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(use srfi.60)


(define (nCr n r)
  (if (or (< r 0) (< n r))
    0
    (let ((k 1))
      (do
        ((i 1 (+ i 1)))
        ((> i r) k)
        (set! k (quotient (* k (- (+ n 1) i)) i))))))

(define yuki420
  (let*
    (
      (x (read))
      (s (- (ash 1 31) 1))
    )
    (display (nCr 31 x))
    (display " ")
    (display
      (if (zero? x)
        0
        (* s (nCr 30 (- x 1)))))
    (newline)))
0