結果
問題 | No.1980 [Cherry 4th Tune D] 停止距離 |
ユーザー |
![]() |
提出日時 | 2022-06-18 19:15:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 849 ms / 3,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 417 ms |
コンパイル使用メモリ | 48,440 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 10:08:24 |
合計ジャッジ時間 | 23,852 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
/* -*- 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; }