結果

問題 No.375 立方体のN等分 (1)
ユーザー uafr_csuafr_cs
提出日時 2017-11-03 21:20:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 336 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 2,911 ms
コンパイル使用メモリ 81,684 KB
実行使用メモリ 55,268 KB
最終ジャッジ日時 2024-05-02 04:57:16
合計ジャッジ時間 11,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
54,832 KB
testcase_01 AC 155 ms
54,976 KB
testcase_02 AC 195 ms
55,068 KB
testcase_03 AC 158 ms
55,052 KB
testcase_04 AC 156 ms
54,924 KB
testcase_05 AC 158 ms
55,012 KB
testcase_06 AC 158 ms
54,860 KB
testcase_07 AC 153 ms
54,456 KB
testcase_08 AC 182 ms
55,000 KB
testcase_09 AC 167 ms
55,052 KB
testcase_10 AC 177 ms
55,180 KB
testcase_11 AC 174 ms
54,836 KB
testcase_12 AC 174 ms
54,760 KB
testcase_13 AC 176 ms
54,960 KB
testcase_14 AC 236 ms
54,904 KB
testcase_15 AC 178 ms
55,028 KB
testcase_16 AC 175 ms
55,048 KB
testcase_17 AC 291 ms
55,052 KB
testcase_18 AC 245 ms
55,156 KB
testcase_19 AC 179 ms
54,880 KB
testcase_20 AC 174 ms
54,712 KB
testcase_21 AC 176 ms
55,120 KB
testcase_22 AC 336 ms
55,016 KB
testcase_23 AC 178 ms
55,268 KB
testcase_24 AC 173 ms
54,936 KB
testcase_25 AC 192 ms
54,904 KB
testcase_26 AC 180 ms
54,780 KB
testcase_27 AC 180 ms
54,840 KB
testcase_28 AC 177 ms
55,028 KB
testcase_29 AC 171 ms
55,248 KB
testcase_30 AC 180 ms
54,952 KB
testcase_31 AC 178 ms
54,844 KB
testcase_32 AC 174 ms
54,844 KB
testcase_33 AC 177 ms
55,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long N = sc.nextLong();
		
		long max = N - 1, min = N - 1;
		for(long i = 1; i * i <= N; i++){
			if(N % i != 0){ continue; }
			
			final long new_N = (N / i);
			for(long j = 1; j * j <= new_N; j++){
				if(new_N % j != 0){ continue; }
				
				final long k = new_N / j;
				
				//System.out.println(i + " " + j + " " + k);
				min = Math.min(min, (i - 1) + (j - 1) + (k - 1));
			}
		}
		
		System.out.println(min + " " + max);
	}
}
0