結果

問題 No.897 compαctree
ユーザー gemmarogemmaro
提出日時 2019-10-28 14:53:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 198 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 15,460 KB
最終ジャッジ日時 2023-10-12 23:03:58
合計ジャッジ時間 2,608 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,392 KB
testcase_01 AC 79 ms
15,236 KB
testcase_02 AC 80 ms
15,240 KB
testcase_03 AC 79 ms
15,396 KB
testcase_04 AC 80 ms
15,152 KB
testcase_05 AC 79 ms
15,240 KB
testcase_06 AC 79 ms
15,448 KB
testcase_07 AC 78 ms
15,152 KB
testcase_08 AC 79 ms
15,404 KB
testcase_09 AC 80 ms
15,460 KB
testcase_10 AC 79 ms
15,356 KB
testcase_11 AC 80 ms
15,308 KB
testcase_12 AC 79 ms
15,172 KB
testcase_13 AC 80 ms
15,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

q = gets.to_i
q.times {
    n, k = gets.chomp.split.map &:to_f

    d = if k == 1
        (n - 1)
    else
        d = ( Math.log( n * (k - 1) + 1 ) / Math.log(k)  - 1 ).ceil
    end

    p d.to_i
}
0