結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-10 01:49:38 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 620 bytes |
| コンパイル時間 | 1,876 ms |
| コンパイル使用メモリ | 144,652 KB |
| 実行使用メモリ | 9,120 KB |
| 最終ジャッジ日時 | 2024-06-12 03:32:39 |
| 合計ジャッジ時間 | 8,591 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 3 TLE * 1 -- * 24 |
コンパイルメッセージ
Main.d(28): Deprecation: foreach: loop index implicitly converted from `size_t` to `uint`
ソースコード
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);
}