結果

問題 No.897 compαctree
ユーザー ducktailducktail
提出日時 2019-10-08 13:09:35
言語 Scheme
(Gauche-0.9.13)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 12,040 KB
最終ジャッジ日時 2023-08-06 19:10:03
合計ジャッジ時間 1,414 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
12,040 KB
testcase_01 AC 20 ms
11,816 KB
testcase_02 AC 19 ms
12,020 KB
testcase_03 AC 18 ms
12,032 KB
testcase_04 AC 18 ms
11,832 KB
testcase_05 AC 19 ms
11,844 KB
testcase_06 AC 18 ms
12,036 KB
testcase_07 AC 18 ms
11,824 KB
testcase_08 AC 19 ms
11,848 KB
testcase_09 AC 20 ms
12,016 KB
testcase_10 AC 20 ms
12,032 KB
testcase_11 AC 19 ms
11,796 KB
testcase_12 AC 19 ms
11,704 KB
testcase_13 AC 19 ms
11,968 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