結果
| 問題 | No.23 技の選択 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-09-01 22:44:27 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 631 bytes | 
| コンパイル時間 | 2,991 ms | 
| コンパイル使用メモリ | 157,696 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-12 04:06:51 | 
| 合計ジャッジ時間 | 3,909 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 33 | 
ソースコード
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;
  if (h > 0)
    e += (h / d + (h % d == 0 ? 0 : 1)).to!real * 3 / 2;
  return e;
}
            
            
            
        