結果
問題 |
No.375 立方体のN等分 (1)
|
ユーザー |
|
提出日時 | 2016-06-10 02:09:52 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 1,754 ms |
コンパイル使用メモリ | 142,372 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 03:32:42 |
合計ジャッジ時間 | 2,827 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 WA * 19 |
ソースコード
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); }