結果
問題 |
No.312 置換処理
|
ユーザー |
|
提出日時 | 2017-06-19 16:12:44 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 783 ms |
コンパイル使用メモリ | 100,668 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 20:15:58 |
合計ジャッジ時間 | 2,520 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 39 WA * 6 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string; void main() { auto n = readln.chomp.to!long; foreach (i; 3..n.nsqrt+1) { if (n % i == 0) { writeln(i); return; } } writeln(n); } pure T nsqrt(T)(T n) { import std.algorithm, std.conv, std.range, core.bitop; if (n <= 1) return n; T m = 1 << (n.bsr / 2 + 1); return iota(1, m).map!"a * a".assumeSorted!"a <= b".lowerBound(n).length.to!T; }