結果
問題 | No.467 隠されていたゲーム |
ユーザー |
|
提出日時 | 2016-12-17 00:58:20 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 720 ms |
コンパイル使用メモリ | 118,584 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 05:39:23 |
合計ジャッジ時間 | 1,477 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto D = readln.split.map!(to!int).array; auto X = readln.split.map!(x => x.to!int.abs).array.reduce!(max); auto ans = X == 0 ? 0 : int.max; foreach (d; D) { auto a = X / d * d; if (d > X) ans = min(ans, 2); else if (a == X) ans = min(ans, X/d); else if (find(D, X-a)) ans = min(ans, X/d+1); else ans = min(ans, X/d+2); } ans.writeln; }