結果

問題 No.456 Millions of Submits!
ユーザー むらためむらため
提出日時 2019-01-19 09:21:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,009 ms / 4,500 ms
コード長 1,058 bytes
コンパイル時間 3,231 ms
コンパイル使用メモリ 174,260 KB
実行使用メモリ 27,512 KB
最終ジャッジ日時 2023-09-22 19:14:54
合計ジャッジ時間 13,263 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
10,264 KB
testcase_01 AC 3 ms
10,020 KB
testcase_02 AC 3 ms
9,984 KB
testcase_03 AC 3 ms
10,016 KB
testcase_04 AC 3 ms
9,848 KB
testcase_05 AC 3 ms
10,024 KB
testcase_06 AC 3 ms
10,268 KB
testcase_07 AC 4 ms
10,168 KB
testcase_08 AC 4 ms
9,956 KB
testcase_09 AC 13 ms
10,092 KB
testcase_10 AC 13 ms
10,104 KB
testcase_11 AC 104 ms
12,780 KB
testcase_12 AC 1,009 ms
27,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include "bits/stdc++.h"

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b)-1; i >= (a); i--)
int scan() {
  int result = 0;
  while (true) {
    auto k = getchar_unlocked();
    if (k < '0' || k > '9') break;
    result = 10 * result + k - '0';
  }
  return result;
}
double calc(int a, int b, double t) {
  if (a == 0) return exp(pow(t, (double)1 / b));
  if (b == 0) return pow(t, (double)1 / a);
  double x = log(11);
  for (int i = 0; i < 10; i++) {
    double f = a * exp(x) + b * x - log(t);
    double g = a * exp(x) + b;
    x -= f / g;
  }
  return exp(exp(x));
}

int A[1000010], B[1000010];
double T[1000010], ANS[1000010];
int main() {
  auto m = scan();
  REP(i, m) {
    A[i] = scan();
    B[i] = scan();
    scanf("%lf\n", &T[i]);
  }
  // REP(i, m) printf("%d %d %.9lf\n", A[i], B[i], T[i]);
  REP(i, m) ANS[i] = calc(A[i], B[i], T[i]);
  REP(i, m) printf("%.9lf\n", ANS[i]);
}
0