結果

問題 No.897 compαctree
ユーザー tenten
提出日時 2020-08-28 05:23:57
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 568 bytes
コンパイル時間 3,047 ms
コンパイル使用メモリ 74,424 KB
実行使用メモリ 47,008 KB
最終ジャッジ日時 2024-11-09 01:00:30
合計ジャッジ時間 7,671 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

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