結果

問題 No.456 Millions of Submits!
ユーザー r_dream0
提出日時 2017-02-21 21:42:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 690 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 68,896 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 18:25:30
合計ジャッジ時間 6,227 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 = (pow(t, 1.0 / b)); // 初期値
      for(int i = 0; i < 12; i++) {
        double nx = x - f(x) / fn(x);
        x = nx;
      }
      printf("%.11f\n", x);
    }
  }
}
0