結果

問題 No.376 立方体のN等分 (2)
ユーザー compass19compass19
提出日時 2016-06-04 23:32:24
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 853 bytes
コンパイル時間 2,334 ms
コンパイル使用メモリ 76,152 KB
実行使用メモリ 46,240 KB
最終ジャッジ日時 2024-04-17 01:32:58
合計ジャッジ時間 9,579 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
42,316 KB
testcase_01 AC 138 ms
42,556 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 TLE -
testcase_06 -- -
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 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

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++;
        }
        while (!sigh){
            sigh = find(l,n);
            l = l + 1;
        }
        System.out.println((l-1) + " " + (n-1));
    }
    public static boolean find(int l,int n){
        for (int i = 0; i < l+1; i++){
            for (int j = 0; j < i+1; 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