結果

問題 No.456 Millions of Submits!
ユーザー rsk0315
提出日時 2018-03-09 03:19:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,992 ms / 4,500 ms
コード長 737 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 58,796 KB
最終ジャッジ日時 2025-01-05 09:09:04
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   scanf("%d", &m);
      |   ~~~~~^~~~~~~~~~
main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     scanf("%d %d %lf", &a, &b, &t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstdint>
#include <algorithm>

int main() {
  int m;
  scanf("%d", &m);

  constexpr double e=exp(1);
  for (int i=0; i<m; ++i) {
    int a, b;
    double t;
    scanf("%d %d %lf", &a, &b, &t);

    if (b == 0) {
      printf("%.12f\n", pow(t, 1.0/a));
      continue;
    }
    if (a == 0) {
      printf("%.12f\n", exp(pow(t, 1.0/b)));
      continue;
    }
    double q=pow(t, 1.0/b)*a/b;
    double lb=std::min(e, q), ub=std::max(e, q);
    for (int i=0; i<50; ++i) {
      asm ("BEGIN:\n\tnop\n\t");
      double mid=(lb+ub)/2.0;
      asm ("END:\n\tnop\n\t");
      (mid*log(mid)<q? lb:ub) = mid;
    }
    printf("%.12f\n", pow(ub, static_cast<double>(b)/a));
  }
}
0