結果

問題 No.456 Millions of Submits!
ユーザー nebukuro09nebukuro09
提出日時 2016-12-08 10:45:26
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 3,444 ms / 4,500 ms
コード長 1,250 bytes
コンパイル時間 2,352 ms
コンパイル使用メモリ 157,704 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 23:25:33
合計ジャッジ時間 13,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 10 ms
4,380 KB
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 9 ms
4,380 KB
testcase_04 AC 9 ms
4,380 KB
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 13 ms
4,380 KB
testcase_08 AC 12 ms
4,376 KB
testcase_09 AC 43 ms
4,376 KB
testcase_10 AC 44 ms
4,376 KB
testcase_11 AC 358 ms
4,376 KB
testcase_12 AC 3,444 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import core.bitop;


void main() {
  auto mem = new real[][][](11, 11, 11);
  foreach (a; 1..11)
    foreach (b; 1..11)
      foreach (t; 0..11) {
        real high = 10.0L;
        real low = 1L;
        foreach (i; 0..100) {
          auto mid = (high + low) / 2.0L;
          if (pow(mid, a) * pow(log(mid), b) >= t)
            high = mid;
          else
            low = mid;
        }
        mem[a][b][t] = high;
    }

  auto M = readln.chomp.to!int;
  foreach (m; 0..M) {
    auto s = readln.split;
    auto a = s[0].to!int;
    auto b = s[1].to!int;
    auto t = s[2].to!real;
    if (a == 0)
      writefln("%.10f", pow(E, pow(t, 1.0L/b)));
    else if (b == 0)
      writefln("%.10f", pow(t, 1.0L/a));
    else {
      real high = mem[a][b][t.ceil.to!int];
      real low = mem[a][b][t.floor.to!int];
      foreach (i; 0..30) {
        auto mid = (high + low) / 2.0L;
        if (pow(mid, a) * pow(log(mid), b) >= t)
          high = mid;
        else
          low = mid;
        }
      writefln("%.10f", high);
    }
  }
}
0