結果

問題 No.1175 Simultaneous Equations
ユーザー ninoinuininoinui
提出日時 2020-08-21 22:53:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 1,901 ms
コンパイル使用メモリ 195,648 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 06:19:41
合計ジャッジ時間 2,396 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  long double a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  auto check = [&](long double mid) {
    if (d * (- b * mid / a + c / a) + e * mid > f) return false;
    else return true;
  };
  long double ok = -2e18, ng = 2e18;
    for (int i = 300; i; i--) {
      long double mid = (ok + ng) / 2;
      (check(mid)) ? ok = mid : ng = mid;
    }
  cout << fixed << setprecision(4) << (c - b * ok) / a << " ";
  cout << fixed << setprecision(4) << ok << "\n";
}
0