結果

問題 No.375 立方体のN等分 (1)
ユーザー compass19compass19
提出日時 2016-06-05 00:25:28
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 831 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 76,480 KB
実行使用メモリ 61,228 KB
最終ジャッジ日時 2024-04-17 03:27:55
合計ジャッジ時間 9,266 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
47,268 KB
testcase_01 AC 123 ms
42,684 KB
testcase_02 RE -
testcase_03 AC 129 ms
42,152 KB
testcase_04 AC 136 ms
42,392 KB
testcase_05 AC 146 ms
42,512 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
    public static boolean find(int l,int n){
        for (int i = l; i >= (int)(l/3); i--){
            for (int j = (int)(n/(i+1))-1; j >= 0; j--){
                int k = l - i - j;
                if (k <= j){
                    if ((i+1)*(j+1)*(k+1)==n){
                        return true;
                    }
                }
            }
        }
        return false;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int l = 0;
        boolean sigh = false;
        while (l*l*l < n){
            l++;
        }
        if (n == 1 || n == 2)   l--;
        while (!sigh){
            sigh = find(l,n);
            l++;
        }
        System.out.println((l-1) + " " + (n-1));
    }
}
0