結果

問題 No.375 立方体のN等分 (1)
ユーザー uafr_csuafr_cs
提出日時 2017-11-03 21:20:39
言語 Java19
(openjdk 21)
結果
AC  
実行時間 320 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 4,109 ms
コンパイル使用メモリ 75,704 KB
実行使用メモリ 56,844 KB
最終ジャッジ日時 2023-08-14 16:48:08
合計ジャッジ時間 11,467 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
56,788 KB
testcase_01 AC 152 ms
56,560 KB
testcase_02 AC 186 ms
56,660 KB
testcase_03 AC 151 ms
56,356 KB
testcase_04 AC 150 ms
56,688 KB
testcase_05 AC 155 ms
56,844 KB
testcase_06 AC 152 ms
56,732 KB
testcase_07 AC 162 ms
56,792 KB
testcase_08 AC 180 ms
56,308 KB
testcase_09 AC 165 ms
56,708 KB
testcase_10 AC 167 ms
56,740 KB
testcase_11 AC 167 ms
56,652 KB
testcase_12 AC 169 ms
56,608 KB
testcase_13 AC 168 ms
56,724 KB
testcase_14 AC 227 ms
56,664 KB
testcase_15 AC 174 ms
56,624 KB
testcase_16 AC 168 ms
56,632 KB
testcase_17 AC 279 ms
56,648 KB
testcase_18 AC 234 ms
56,608 KB
testcase_19 AC 173 ms
56,720 KB
testcase_20 AC 166 ms
56,596 KB
testcase_21 AC 166 ms
56,692 KB
testcase_22 AC 320 ms
56,552 KB
testcase_23 AC 169 ms
56,548 KB
testcase_24 AC 167 ms
56,732 KB
testcase_25 AC 184 ms
56,448 KB
testcase_26 AC 170 ms
56,344 KB
testcase_27 AC 172 ms
56,316 KB
testcase_28 AC 171 ms
56,620 KB
testcase_29 AC 167 ms
56,296 KB
testcase_30 AC 170 ms
56,500 KB
testcase_31 AC 172 ms
56,580 KB
testcase_32 AC 165 ms
56,632 KB
testcase_33 AC 167 ms
56,648 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