結果

問題 No.1176 少ない質問
ユーザー ApassApass
提出日時 2020-08-21 22:11:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 1,000 ms
コード長 785 bytes
コンパイル時間 3,819 ms
コンパイル使用メモリ 74,924 KB
実行使用メモリ 37,440 KB
最終ジャッジ日時 2024-04-23 05:59:32
合計ジャッジ時間 5,549 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,272 KB
testcase_01 AC 51 ms
37,228 KB
testcase_02 AC 51 ms
37,032 KB
testcase_03 AC 50 ms
37,412 KB
testcase_04 AC 50 ms
37,440 KB
testcase_05 AC 52 ms
36,760 KB
testcase_06 AC 52 ms
37,276 KB
testcase_07 AC 51 ms
36,936 KB
testcase_08 AC 52 ms
36,800 KB
testcase_09 AC 54 ms
37,196 KB
testcase_10 AC 51 ms
37,004 KB
testcase_11 AC 52 ms
37,216 KB
testcase_12 AC 52 ms
37,164 KB
testcase_13 AC 51 ms
37,312 KB
testcase_14 AC 51 ms
37,144 KB
testcase_15 AC 53 ms
36,648 KB
testcase_16 AC 51 ms
37,108 KB
testcase_17 AC 51 ms
37,144 KB
testcase_18 AC 52 ms
37,092 KB
testcase_19 AC 50 ms
37,248 KB
testcase_20 AC 50 ms
37,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class B_FewQuestions {
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static StringTokenizer st;

    private static long readLong() throws IOException {
        while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return Long.parseLong(st.nextToken());
    }

    public static void main(String[] args) throws IOException {
        long A = readLong();

        if (A == 5) {
            System.out.println(5);
        } else {
            long min = Math.min(2 * (int) (Math.ceil(Math.log(A) / Math.log(2))),
                    3 * (int) (Math.ceil(Math.log(A) / Math.log(3))));
            System.out.println(min);
        }
    }
}
0