結果

問題 No.375 立方体のN等分 (1)
ユーザー atkrymatkrym
提出日時 2016-11-07 21:32:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 481 ms / 5,000 ms
コード長 610 bytes
コンパイル時間 2,542 ms
コンパイル使用メモリ 77,708 KB
実行使用メモリ 42,712 KB
最終ジャッジ日時 2024-05-03 23:01:35
合計ジャッジ時間 9,636 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
42,068 KB
testcase_01 AC 152 ms
42,232 KB
testcase_02 AC 220 ms
42,448 KB
testcase_03 AC 149 ms
42,292 KB
testcase_04 AC 144 ms
42,288 KB
testcase_05 AC 151 ms
42,516 KB
testcase_06 AC 137 ms
42,260 KB
testcase_07 AC 158 ms
42,456 KB
testcase_08 AC 195 ms
42,532 KB
testcase_09 AC 152 ms
42,428 KB
testcase_10 AC 151 ms
42,320 KB
testcase_11 AC 150 ms
42,396 KB
testcase_12 AC 166 ms
42,540 KB
testcase_13 AC 151 ms
42,416 KB
testcase_14 AC 300 ms
42,440 KB
testcase_15 AC 182 ms
42,452 KB
testcase_16 AC 177 ms
42,640 KB
testcase_17 AC 414 ms
42,636 KB
testcase_18 AC 316 ms
42,536 KB
testcase_19 AC 170 ms
42,624 KB
testcase_20 AC 147 ms
42,328 KB
testcase_21 AC 143 ms
42,316 KB
testcase_22 AC 481 ms
42,104 KB
testcase_23 AC 153 ms
42,660 KB
testcase_24 AC 149 ms
42,604 KB
testcase_25 AC 192 ms
42,448 KB
testcase_26 AC 162 ms
42,644 KB
testcase_27 AC 175 ms
42,440 KB
testcase_28 AC 157 ms
42,680 KB
testcase_29 AC 147 ms
42,688 KB
testcase_30 AC 177 ms
42,512 KB
testcase_31 AC 176 ms
42,488 KB
testcase_32 AC 166 ms
42,712 KB
testcase_33 AC 163 ms
42,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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