結果

問題 No.897 compαctree
ユーザー ducktailducktail
提出日時 2019-10-08 13:09:35
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-24 13:53:44
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
16,128 KB
testcase_01 AC 25 ms
16,128 KB
testcase_02 AC 25 ms
16,256 KB
testcase_03 AC 25 ms
16,128 KB
testcase_04 AC 26 ms
16,256 KB
testcase_05 AC 24 ms
16,128 KB
testcase_06 AC 25 ms
16,000 KB
testcase_07 AC 25 ms
16,256 KB
testcase_08 AC 25 ms
16,128 KB
testcase_09 AC 27 ms
16,000 KB
testcase_10 AC 25 ms
16,256 KB
testcase_11 AC 26 ms
16,000 KB
testcase_12 AC 25 ms
15,872 KB
testcase_13 AC 27 ms
15,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (read-list q)
  (cond [(zero? q) '()]
        [else (let* ([n (read)]
                     [k (read)])
                (cons (list n k) (read-list (- q 1))))]))

(define (solve nk)
  (let ([n (car nk)]
        [k (cadr nk)])
    (cond [(= k 1) (- n 1)]
          [else (- (inexact->exact (ceiling (log (+ 1 (* n (- k 1))) k))) 1)])))

(define (main args)
  (let* ([q (read)]
         [lnk (read-list q)])
    (for-each print (map solve lnk)))
  0)
0