結果

問題 No.456 Millions of Submits!
コンテスト
ユーザー te-sh
提出日時 2017-12-06 13:47:06
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 889 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,493 ms
コンパイル使用メモリ 135,768 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2026-03-05 17:52:03
合計ジャッジ時間 10,642 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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!real; rd.popFront();
    auto b = rd.front.to!real; rd.popFront();
    auto t = rd.front.to!real;

    if (b == 0) {
      writefln("%.10f", t ^^ (1.0L/a));
      continue;
    } else if (a == 0) {
      writefln("%.10f", E ^^ (t ^^ (1.0L/b)));
      continue;
    }

    auto r = a / b * t ^^ (1.0L / b);

    auto calc(real x)
    {
      return x * log(x);
    }

    auto eps = 0, mi = eps, ma = 100;

    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, r)).back[0] + eps;

    writefln("%.10f", x ^^ (b/a));
  }
}
0