結果

問題 No.897 compαctree
ユーザー tentententen
提出日時 2020-08-28 05:23:57
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 568 bytes
コンパイル時間 3,264 ms
コンパイル使用メモリ 71,776 KB
実行使用メモリ 60,252 KB
最終ジャッジ日時 2023-08-08 17:57:49
合計ジャッジ時間 8,063 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
60,252 KB
testcase_01 AC 125 ms
56,124 KB
testcase_02 AC 124 ms
55,880 KB
testcase_03 AC 127 ms
56,052 KB
testcase_04 AC 126 ms
55,788 KB
testcase_05 AC 126 ms
56,284 KB
testcase_06 AC 124 ms
55,536 KB
testcase_07 AC 125 ms
55,712 KB
testcase_08 AC 123 ms
55,820 KB
testcase_09 AC 125 ms
55,636 KB
testcase_10 AC 126 ms
55,876 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
    	    while (sum < n) {
    	        count++;
    	        sum += base;
    	        base *= k;
    	    }
    	    sb.append(count - 1).append("\n");
    	}
    	System.out.print(sb);
    }
    
}
0