結果
問題 |
No.23 技の選択
|
ユーザー |
|
提出日時 | 2016-09-01 22:39:50 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 614 bytes |
コンパイル時間 | 2,610 ms |
コンパイル使用メモリ | 158,816 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 04:05:53 |
合計ジャッジ時間 | 3,440 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 10 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random; import std.string, std.conv, std.stdio, std.typecons; void main() { auto rd = readln.split.map!(to!int); auto h = rd[0], a = rd[1], d = rd[2]; auto maxCa = h / a + (h % a == 0 ? 0 : 1); auto minE = h.to!real; foreach (ca; 0..maxCa + 1) { auto e = calc(h, a, d, ca); minE = min(minE, e); } writefln("%f", minE); } real calc(int h, int a, int d, int ca) { h -= a * ca; auto e = ca.to!real; e += (h / d + (h % d == 0 ? 0 : 1)).to!real * 3 / 2; return e; }