結果

問題 No.1175 Simultaneous Equations
ユーザー ninoinui
提出日時 2020-08-21 22:53:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 194,536 KB
最終ジャッジ日時 2025-01-13 06:26:53
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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