結果
問題 | No.897 compαctree |
ユーザー |
![]() |
提出日時 | 2019-10-04 21:23:52 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 10,575 ms |
コンパイル使用メモリ | 406,928 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 07:04:58 |
合計ジャッジ時間 | 11,377 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
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();if k == 1 {println!("{}", n - k);continue;}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();}