結果

問題 No.1980 [Cherry 4th Tune D] 停止距離
ユーザー tnakao0123tnakao0123
提出日時 2022-06-18 19:15:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 754 ms / 3,000 ms
コード長 770 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 50,344 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 16:51:09
合計ジャッジ時間 20,918 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 127 ms
5,376 KB
testcase_02 AC 516 ms
5,376 KB
testcase_03 AC 357 ms
5,376 KB
testcase_04 AC 90 ms
5,376 KB
testcase_05 AC 454 ms
5,376 KB
testcase_06 AC 720 ms
5,376 KB
testcase_07 AC 743 ms
5,376 KB
testcase_08 AC 738 ms
5,376 KB
testcase_09 AC 715 ms
5,376 KB
testcase_10 AC 719 ms
5,376 KB
testcase_11 AC 718 ms
5,376 KB
testcase_12 AC 718 ms
5,376 KB
testcase_13 AC 728 ms
5,376 KB
testcase_14 AC 726 ms
5,376 KB
testcase_15 AC 725 ms
5,376 KB
testcase_16 AC 734 ms
5,376 KB
testcase_17 AC 730 ms
5,376 KB
testcase_18 AC 739 ms
5,376 KB
testcase_19 AC 735 ms
5,376 KB
testcase_20 AC 754 ms
5,376 KB
testcase_21 AC 744 ms
5,376 KB
testcase_22 AC 742 ms
5,376 KB
testcase_23 AC 736 ms
5,376 KB
testcase_24 AC 733 ms
5,376 KB
testcase_25 AC 743 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1980.cc:  No.1980 [Cherry 4th Tune D] 停止距離 - yukicoder
 */

#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

/* constant */

const int CNT = 200;

/* typedef */

/* global variables */

double s(double v, double t, double m) {
  return v * t + v * v / (20 * m);
}

/* subroutines */

/* main */

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

  while (tn--) {
    double t, m, l;
    scanf("%lf%lf%lf", &t, &m, &l);

    double v0 = 0.0, v1 = 5100.0 * 1000 / 3600;
    for (int cnt = 0; cnt < CNT; cnt++) {
      double v = (v0 + v1) / 2;
      if (s(v, t, m) <= l) v0 = v;
      else v1 = v;
    }

    double v = v1 * 3600 / 1000;
    v = floor(v * 100) / 100;
    printf("%.2lf\n", v);
  }
  return 0;
}
0