結果

問題 No.375 立方体のN等分 (1)
ユーザー TosukeTosuke
提出日時 2016-06-10 01:49:38
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 1,447 ms
コンパイル使用メモリ 143,968 KB
実行使用メモリ 7,268 KB
最終ジャッジ日時 2023-09-02 21:14:36
合計ジャッジ時間 8,234 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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 AC 1 ms
4,372 KB
testcase_05 AC 2 ms
4,368 KB
testcase_06 AC 26 ms
4,368 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.d(28): Deprecation: foreach: loop index implicitly converted from `size_t` to `uint`

ソースコード

diff #

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

void main(){
	auto n = readln.strip.to!ulong;
	auto max = n - 1;
	
	auto r = (a){
		import std.container;
		SList!ulong v;
		ulong i = 2;
		while(a != 1){
			while(a % i == 0){
				v.insertFront(i);
				a /= i;
			}
			i++;
		}
		return v;
	}(n);
	ulong[] v = [1, 1, 1];
	foreach(a; r[]){
		auto k = (){
			ulong bf = ulong.max , t;
			foreach(uint i, y; v[]){
				t = y < bf ? i : t;
				bf = y < bf ? y : bf;
			}
			return t;
		}();
		v[k.to!uint] *= a;
	}
	auto min = v.map!("a-1").sum;
	
	writef("%d %d", min, max);
}
0