結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
![]() |
提出日時 | 2016-06-05 00:25:28 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 831 bytes |
コンパイル時間 | 2,454 ms |
コンパイル使用メモリ | 85,896 KB |
実行使用メモリ | 60,032 KB |
最終ジャッジ日時 | 2024-10-08 13:17:00 |
合計ジャッジ時間 | 10,179 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 RE * 1 TLE * 1 -- * 27 |
ソースコード
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)); } }