結果
| 問題 | No.897 compαctree |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-28 05:26:07 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 57 ms / 2,000 ms |
| + 96µs | |
| コード長 | 664 bytes |
| 記録 | |
| コンパイル時間 | 1,573 ms |
| コンパイル使用メモリ | 86,096 KB |
| 実行使用メモリ | 45,248 KB |
| 最終ジャッジ日時 | 2026-09-21 15:28:28 |
| 合計ジャッジ時間 | 3,886 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_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