結果

問題 No.897 compαctree
ユーザー akakimidoriakakimidori
提出日時 2019-10-04 21:22:51
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 591 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 153,296 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-14 10:03:43
合計ジャッジ時間 4,153 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let q: usize = it.next().unwrap().parse().unwrap();
    for _ in 0..q {
        let n: usize = it.next().unwrap().parse().unwrap();
        let k: usize = it.next().unwrap().parse().unwrap();
        let mut sum = 1;
        let mut d = k;
        let mut ans = 0;
        while sum < n {
            ans += 1;
            sum += d;
            d *= k;
        }
        println!("{}", ans);
    }
}

fn main() {
    run();
}
0