結果

問題 No.375 立方体のN等分 (1)
ユーザー compass19compass19
提出日時 2016-06-04 23:41:16
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 882 bytes
コンパイル時間 2,453 ms
コンパイル使用メモリ 76,436 KB
実行使用メモリ 46,420 KB
最終ジャッジ日時 2024-04-17 01:39:16
合計ジャッジ時間 10,339 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
42,556 KB
testcase_01 AC 164 ms
42,456 KB
testcase_02 RE -
testcase_03 AC 164 ms
42,192 KB
testcase_04 AC 165 ms
42,344 KB
testcase_05 AC 397 ms
42,292 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 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));
    }
    public static boolean find(int l,int n){
        for (int i = l; i >= 0; i--){
            for (int j = i; j >= 0; j--){
                if (i + j <= l){
                    int k = l - i - j;
                    if (k <= j){
                        if ((i+1)*(j+1)*(k+1)==n){
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }
}
0