結果

問題 No.897 compαctree
ユーザー htensaihtensai
提出日時 2019-12-07 11:10:37
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 510 bytes
コンパイル時間 1,762 ms
コンパイル使用メモリ 72,816 KB
実行使用メモリ 60,344 KB
最終ジャッジ日時 2023-08-26 05:27:45
合計ジャッジ時間 7,138 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
60,344 KB
testcase_01 AC 114 ms
55,976 KB
testcase_02 AC 117 ms
56,136 KB
testcase_03 AC 114 ms
55,316 KB
testcase_04 AC 112 ms
55,848 KB
testcase_05 AC 114 ms
55,700 KB
testcase_06 AC 111 ms
55,780 KB
testcase_07 AC 110 ms
55,800 KB
testcase_08 AC 116 ms
55,872 KB
testcase_09 AC 118 ms
55,732 KB
testcase_10 AC 111 ms
55,924 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++) {
		    sb.append(getCount(sc.nextInt(), sc.nextInt())).append("\n");
		}
		System.out.print(sb);
   }
   
   static int getCount(long n, int k) {
       int idx = 0;
       while (n > 0) {
           n -= (long)(Math.pow(k, idx));
           idx++;
       }
       return idx - 1;
   }
}

0