結果

問題 No.420 mod2漸化式
ユーザー keiden
提出日時 2024-09-22 16:24:07
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 408 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 22,400 KB
最終ジャッジ日時 2024-09-22 16:24:12
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

(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