結果
| 問題 | No.897 compαctree |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-28 05:26:07 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 664 bytes |
| 記録 | |
| コンパイル時間 | 1,780 ms |
| コンパイル使用メモリ | 82,188 KB |
| 実行使用メモリ | 41,728 KB |
| 最終ジャッジ日時 | 2026-05-09 05:52:21 |
| 合計ジャッジ時間 | 3,627 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int q = sc.nextInt();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < q; i++) {
int n = sc.nextInt();
long k = sc.nextInt();
int count = 0;
long sum = 0;
long base = 1;
if (k == 1) {
count = n;
} else {
while (sum < n) {
count++;
sum += base;
base *= k;
}
}
sb.append(count - 1).append("\n");
}
System.out.print(sb);
}
}
tenten