結果
問題 | No.375 立方体のN等分 (1) |
ユーザー | compass19 |
提出日時 | 2016-06-05 00:08:28 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 906 bytes |
コンパイル時間 | 2,785 ms |
コンパイル使用メモリ | 76,432 KB |
実行使用メモリ | 45,420 KB |
最終ジャッジ日時 | 2024-04-17 03:19:48 |
合計ジャッジ時間 | 9,921 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 144 ms
42,204 KB |
testcase_01 | AC | 140 ms
42,372 KB |
testcase_02 | RE | - |
testcase_03 | AC | 140 ms
42,564 KB |
testcase_04 | AC | 131 ms
42,024 KB |
testcase_05 | AC | 169 ms
41,972 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 | -- | - |
ソースコード
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 >= (int)(l/3); i--){ for (int j = (int)(n/(i+1))-1; 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; } }