結果

問題 No.456 Millions of Submits!
コンテスト
ユーザー r_dream0
提出日時 2017-02-21 21:45:42
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 674 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 408 ms
コンパイル使用メモリ 80,464 KB
実行使用メモリ 16,080 KB
最終ジャッジ日時 2026-03-08 23:35:46
合計ジャッジ時間 8,683 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int a, b;
double t;
double f(double x) {
  return pow(x, a) * pow(log(x), b) - t;
}

double fn(double x) {
  return a * pow(x, a - 1) * pow(log(x), b) + b * pow(x, a - 1) * pow(log(x), b - 1);
}
int main() {
  int T;
  scanf("%d", &T);
  while(T--) {
    scanf("%d %d %lf", &a, &b, &t);
    if(a == 0) {
      printf("%.11f\n", exp(pow(t, 1.0 / b)));
    }else if(b == 0) {
      printf("%.11f\n", pow(t, 1.0 / a));
    }else{
      double x = 2; // 初期値
      for(int i = 0; i < 50; i++) {
        double nx = x - f(x) / fn(x);
        x = nx;
      }
      printf("%.11f\n", x);
    }
  }
}
0