結果

問題 No.456 Millions of Submits!
ユーザー koba-e964koba-e964
提出日時 2016-12-08 00:26:48
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 918 bytes
コンパイル時間 1,478 ms
コンパイル使用メモリ 34,488 KB
実行使用メモリ 97,976 KB
最終ジャッジ日時 2023-09-05 08:52:22
合計ジャッジ時間 9,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
97,880 KB
testcase_01 AC 43 ms
97,976 KB
testcase_02 AC 45 ms
97,928 KB
testcase_03 AC 43 ms
97,936 KB
testcase_04 AC 47 ms
97,912 KB
testcase_05 AC 44 ms
97,892 KB
testcase_06 AC 48 ms
97,920 KB
testcase_07 AC 48 ms
97,920 KB
testcase_08 AC 55 ms
97,976 KB
testcase_09 AC 97 ms
97,924 KB
testcase_10 AC 98 ms
97,944 KB
testcase_11 AC 580 ms
97,868 KB
testcase_12 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <cstdio>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;

const int N = 11;
const int W = 100001;
double memo[N][N][W];

double solve(int a, int b, double t) {
  int idx = floor(t * 10000 + 0.5);
  if (memo[a][b][idx] >= 0) {
    return memo[a][b][idx];
  }
  double &ret = memo[a][b][idx];
  if (b == 0) {
    return pow(t, 1.0 / a);
  }
  if (a == 0) {
    return exp(pow(t, 1.0 / b));
  }
  double lo = 1.0, hi = 10;
  REP(loop_cnt, 0, 36) {
    double mid = (lo + hi) / 2;
    if (pow(mid, a) * pow(log(mid), b) <= t) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  return ret=lo;
}

int main(void){
  int m;
  scanf("%d", &m);
  REP(i, 0, N) {
    REP(j, 0, N) {
      REP(k, 0, W) {
	memo[i][j][k] = -1;
      }
    }
  }
  REP(i, 0, m) {
    int a, b;
    double t;
    scanf("%d%d%lf", &a, &b, &t);
    printf("%.15f\n", solve(a, b, t));
  }
}
0