結果

問題 No.375 立方体のN等分 (1)
ユーザー tentententen
提出日時 2020-12-04 18:11:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 279 ms / 5,000 ms
コード長 736 bytes
コンパイル時間 2,801 ms
コンパイル使用メモリ 73,852 KB
実行使用メモリ 58,884 KB
最終ジャッジ日時 2023-10-13 07:42:18
合計ジャッジ時間 10,727 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
56,864 KB
testcase_01 AC 151 ms
57,004 KB
testcase_02 AC 184 ms
58,524 KB
testcase_03 AC 149 ms
56,844 KB
testcase_04 AC 153 ms
56,936 KB
testcase_05 AC 149 ms
56,776 KB
testcase_06 AC 154 ms
56,812 KB
testcase_07 AC 160 ms
56,600 KB
testcase_08 AC 172 ms
56,664 KB
testcase_09 AC 162 ms
56,800 KB
testcase_10 AC 167 ms
56,848 KB
testcase_11 AC 166 ms
56,540 KB
testcase_12 AC 170 ms
57,180 KB
testcase_13 AC 167 ms
56,832 KB
testcase_14 AC 216 ms
56,700 KB
testcase_15 AC 172 ms
56,524 KB
testcase_16 AC 167 ms
56,944 KB
testcase_17 AC 251 ms
56,760 KB
testcase_18 AC 226 ms
56,960 KB
testcase_19 AC 174 ms
56,944 KB
testcase_20 AC 168 ms
56,564 KB
testcase_21 AC 164 ms
56,776 KB
testcase_22 AC 279 ms
56,916 KB
testcase_23 AC 171 ms
56,984 KB
testcase_24 AC 167 ms
56,940 KB
testcase_25 AC 183 ms
57,100 KB
testcase_26 AC 168 ms
56,684 KB
testcase_27 AC 169 ms
54,964 KB
testcase_28 AC 171 ms
56,920 KB
testcase_29 AC 165 ms
57,140 KB
testcase_30 AC 166 ms
58,884 KB
testcase_31 AC 168 ms
56,972 KB
testcase_32 AC 167 ms
56,924 KB
testcase_33 AC 170 ms
57,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long max = 0;
        long min = Long.MAX_VALUE;
        for (long i = 1; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                long m = n / i;
                for (long j = i; j <= Math.sqrt(m); j++) {
                    if (m % j == 0) {
                        long k = m / j;
                        long sum = i + j + k - 3;
                        max = Math.max(max, sum);
                        min = Math.min(min, sum);
                    }
                }
            }
        }
        System.out.println(min + " " + max);
    }
}
0