結果

問題 No.1176 少ない質問
ユーザー ApassApass
提出日時 2020-08-21 22:11:55
言語 Java19
(openjdk 21)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 785 bytes
コンパイル時間 3,486 ms
コンパイル使用メモリ 71,620 KB
実行使用メモリ 49,764 KB
最終ジャッジ日時 2023-08-05 08:13:11
合計ジャッジ時間 5,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,356 KB
testcase_01 AC 43 ms
49,456 KB
testcase_02 AC 42 ms
49,764 KB
testcase_03 AC 43 ms
49,284 KB
testcase_04 AC 42 ms
49,448 KB
testcase_05 AC 43 ms
49,268 KB
testcase_06 AC 42 ms
49,420 KB
testcase_07 AC 44 ms
49,428 KB
testcase_08 AC 42 ms
49,180 KB
testcase_09 AC 41 ms
49,232 KB
testcase_10 AC 41 ms
49,152 KB
testcase_11 AC 42 ms
49,596 KB
testcase_12 AC 41 ms
49,656 KB
testcase_13 AC 41 ms
49,400 KB
testcase_14 AC 40 ms
49,492 KB
testcase_15 AC 40 ms
49,152 KB
testcase_16 AC 43 ms
49,268 KB
testcase_17 AC 42 ms
49,424 KB
testcase_18 AC 41 ms
49,596 KB
testcase_19 AC 40 ms
49,352 KB
testcase_20 AC 41 ms
49,328 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