結果

問題 No.1176 少ない質問
ユーザー RISE70226821RISE70226821
提出日時 2020-09-08 15:58:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 41 ms / 1,000 ms
コード長 2,307 bytes
コンパイル時間 2,692 ms
コンパイル使用メモリ 74,184 KB
実行使用メモリ 50,040 KB
最終ジャッジ日時 2023-08-19 23:32:42
合計ジャッジ時間 4,925 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
50,040 KB
testcase_01 AC 40 ms
49,496 KB
testcase_02 AC 41 ms
49,544 KB
testcase_03 AC 40 ms
49,432 KB
testcase_04 AC 40 ms
49,976 KB
testcase_05 AC 40 ms
49,548 KB
testcase_06 AC 40 ms
49,848 KB
testcase_07 AC 40 ms
49,464 KB
testcase_08 AC 40 ms
47,416 KB
testcase_09 AC 41 ms
49,388 KB
testcase_10 AC 41 ms
49,580 KB
testcase_11 AC 41 ms
49,432 KB
testcase_12 AC 41 ms
49,460 KB
testcase_13 AC 40 ms
49,464 KB
testcase_14 AC 41 ms
49,420 KB
testcase_15 AC 41 ms
49,484 KB
testcase_16 AC 40 ms
49,420 KB
testcase_17 AC 40 ms
49,760 KB
testcase_18 AC 41 ms
49,568 KB
testcase_19 AC 41 ms
49,512 KB
testcase_20 AC 41 ms
49,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		// 入力
		FastScanner sc = new FastScanner(System.in);
		long A = sc.nextLong();
		
		// 計算
		long result = Long.MAX_VALUE;
		for(long M = 2L; M <= 10L; M++){
			long N = 1L;
			long multi = M;
			while(multi < A){
				multi *= M;
				N++;
			}
			if(result > M*N){
				result = M*N;
			}
		}
		
		
		// 出力
		System.out.println(result);
	}
	

	// 高速スキャナー
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
             return Double.parseDouble(next());
         }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        } 
    }
}

0