結果

問題 No.375 立方体のN等分 (1)
ユーザー TosukeTosuke
提出日時 2016-06-10 02:09:52
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 1,744 ms
コンパイル使用メモリ 140,516 KB
実行使用メモリ 4,496 KB
最終ジャッジ日時 2023-09-02 21:14:39
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,368 KB
testcase_01 AC 2 ms
4,368 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,372 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,368 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,368 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,368 KB
testcase_17 WA -
testcase_18 AC 1 ms
4,372 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
4,368 KB
testcase_22 AC 2 ms
4,368 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,372 KB
testcase_29 WA -
testcase_30 AC 3 ms
4,372 KB
testcase_31 WA -
testcase_32 AC 4 ms
4,368 KB
testcase_33 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm;
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.math;

void main(){
	auto n = readln.strip.to!ulong;
	auto max = n - 1;
	
	
	auto a = (x){
		foreach_reverse(p; 2..x.to!real.cbrt.ceil.to!ulong){
			if(x % p == 0){
				return p;
			}
		}
		return 1;
	}(n);
	n /= a;
	auto b = (x){
		foreach_reverse(p; 2..x.to!real.sqrt.ceil.to!ulong){
			if(x % p == 0){
				return p;
			}
		}
		return 1;
	}(n);
	auto c = n / b;
	
	auto min = (a - 1) + (b - 1) + (c - 1);
	
	writef("%d %d", min, max);
}
0