結果

問題 No.456 Millions of Submits!
ユーザー te-sh
提出日時 2017-12-05 17:22:26
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 2,472 ms
コンパイル使用メモリ 159,800 KB
実行使用メモリ 10,268 KB
最終ジャッジ日時 2024-06-12 22:48:01
合計ジャッジ時間 10,464 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 6 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions
import std.typecons;  // Tuple, Nullable, BigFlags

void main()
{
  auto m = readln.chomp.to!int;
  foreach (_; 0..m) {
    auto rd = readln.splitter;
    auto a = rd.front.to!int; rd.popFront();
    auto b = rd.front.to!int; rd.popFront();
    auto t = rd.front.to!real;

    auto calc(real x)
    {
      return x * a + log(x) * b - log(t);
    }

    auto eps = 1.0e-12L, mi = eps, ma = mi;
    while (calc(ma) < 0) ma *= 2;

    auto bsearch = iota(mi, ma, 1.0e-10L).map!(n => tuple(n, calc(n))).assumeSorted!"a[1] < b[1]";
    auto x = bsearch.lowerBound(tuple(0, 0)).back[0] + eps;

    writefln("%.10f", E ^^ x);
  }
}
0