結果

問題 No.456 Millions of Submits!
ユーザー rsk0315rsk0315
提出日時 2018-03-09 03:19:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,981 ms / 4,500 ms
コード長 737 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 62,936 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 13:56:55
合計ジャッジ時間 8,052 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 22 ms
5,376 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 203 ms
5,376 KB
testcase_12 AC 1,981 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstdint>
#include <algorithm>

int main() {
  int m;
  scanf("%d", &m);

  constexpr double e=exp(1);
  for (int i=0; i<m; ++i) {
    int a, b;
    double t;
    scanf("%d %d %lf", &a, &b, &t);

    if (b == 0) {
      printf("%.12f\n", pow(t, 1.0/a));
      continue;
    }
    if (a == 0) {
      printf("%.12f\n", exp(pow(t, 1.0/b)));
      continue;
    }
    double q=pow(t, 1.0/b)*a/b;
    double lb=std::min(e, q), ub=std::max(e, q);
    for (int i=0; i<50; ++i) {
      asm ("BEGIN:\n\tnop\n\t");
      double mid=(lb+ub)/2.0;
      asm ("END:\n\tnop\n\t");
      (mid*log(mid)<q? lb:ub) = mid;
    }
    printf("%.12f\n", pow(ub, static_cast<double>(b)/a));
  }
}
0