結果

問題 No.375 立方体のN等分 (1)
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-17 01:47:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 74,168 KB
実行使用メモリ 60,320 KB
最終ジャッジ日時 2023-08-17 07:46:36
合計ジャッジ時間 9,010 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
56,900 KB
testcase_01 AC 138 ms
56,664 KB
testcase_02 AC 183 ms
56,760 KB
testcase_03 AC 136 ms
56,864 KB
testcase_04 AC 137 ms
57,208 KB
testcase_05 AC 143 ms
56,420 KB
testcase_06 WA -
testcase_07 AC 150 ms
56,944 KB
testcase_08 AC 180 ms
56,760 KB
testcase_09 WA -
testcase_10 AC 156 ms
57,188 KB
testcase_11 AC 157 ms
56,856 KB
testcase_12 AC 160 ms
56,980 KB
testcase_13 AC 155 ms
57,024 KB
testcase_14 AC 245 ms
56,876 KB
testcase_15 AC 165 ms
56,832 KB
testcase_16 AC 157 ms
56,952 KB
testcase_17 AC 312 ms
56,876 KB
testcase_18 AC 252 ms
56,980 KB
testcase_19 AC 160 ms
56,756 KB
testcase_20 AC 137 ms
56,716 KB
testcase_21 AC 140 ms
56,840 KB
testcase_22 AC 346 ms
56,672 KB
testcase_23 AC 155 ms
57,036 KB
testcase_24 AC 139 ms
56,964 KB
testcase_25 AC 179 ms
56,668 KB
testcase_26 AC 154 ms
56,932 KB
testcase_27 AC 162 ms
56,664 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 157 ms
56,704 KB
testcase_32 AC 142 ms
57,140 KB
testcase_33 AC 157 ms
56,512 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 M = (long)Math.cbrt(N);
        long Tmax = N-1;
        long Tmin = Tmax;
        for(long i=2; i<=M; i++){
            long a=N;
            if(a%i==0){
                long m = (long)Math.sqrt(a/i);
                for(long j=i; j<=m; j++){
                    long b = a/i;
                    if(b%j==0){
                        long c = b/j;
                        Tmin = Math.min(Tmin,i+j+c-3);
                    }
                }
            }
        }
        System.out.println(Tmin+" "+Tmax);
    }
}
0