結果

問題 No.456 Millions of Submits!
ユーザー tnakao0123tnakao0123
提出日時 2016-12-08 17:45:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3,358 ms / 4,500 ms
コード長 1,121 bytes
コンパイル時間 1,867 ms
コンパイル使用メモリ 83,576 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 10:38:23
合計ジャッジ時間 13,077 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 456.cc: No.456 Millions of Submits! - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int CNT = 60;

typedef long double ld;

const ld MIN_N = 0.0;
const ld MAX_N = expl(10);
const ld DELTA = 1e-10;

/* typedef */

/* global variables */

ld powld(ld a, int b) {
  ld p = 1.0;
  while (b) {
    if (b & 1) p *= a;
    a *= a;
    b >>= 1;
  }
  return p;
}

/* subroutines */

/* main */

int main() {
  int m;
  scanf("%d", &m);
  while (m--) {
    int ai, bi;
    ld ti;
    scanf("%d%d%Lf", &ai, &bi, &ti);

    ld ln = (bi > 0) ? 1.0 : 0.0;
    ld rn = MAX_N;
    while (ln + DELTA < rn) {
      ld n = (ln + rn) / 2;
      ld t = powld(n, ai) * powld(logl(n), bi);
      if (t <= ti) ln = n;
      else rn = n;
    }

    printf("%.11Lf\n", ln);
  }
  return 0;
}
0