結果

問題 No.550 夏休みの思い出(1)
ユーザー 0x19f0x19f
提出日時 2017-07-29 00:10:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 829 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 65,768 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 13:48:49
合計ジャッジ時間 2,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 9 ms
6,944 KB
testcase_06 AC 9 ms
6,944 KB
testcase_07 AC 10 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 10 ms
6,944 KB
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 9 ms
6,944 KB
testcase_14 AC 10 ms
6,944 KB
testcase_15 AC 18 ms
6,940 KB
testcase_16 AC 11 ms
6,944 KB
testcase_17 AC 9 ms
6,940 KB
testcase_18 AC 9 ms
6,944 KB
testcase_19 AC 10 ms
6,940 KB
testcase_20 AC 18 ms
6,940 KB
testcase_21 AC 18 ms
6,944 KB
testcase_22 AC 9 ms
6,940 KB
testcase_23 AC 11 ms
6,940 KB
testcase_24 AC 10 ms
6,940 KB
testcase_25 AC 10 ms
6,940 KB
testcase_26 AC 10 ms
6,940 KB
testcase_27 AC 10 ms
6,940 KB
testcase_28 AC 11 ms
6,940 KB
testcase_29 AC 10 ms
6,944 KB
testcase_30 AC 10 ms
6,940 KB
testcase_31 AC 9 ms
6,940 KB
testcase_32 AC 10 ms
6,940 KB
testcase_33 AC 10 ms
6,940 KB
testcase_34 AC 10 ms
6,944 KB
testcase_35 AC 10 ms
6,940 KB
testcase_36 AC 10 ms
6,944 KB
testcase_37 AC 10 ms
6,940 KB
testcase_38 AC 9 ms
6,944 KB
testcase_39 AC 9 ms
6,940 KB
testcase_40 AC 9 ms
6,940 KB
testcase_41 AC 10 ms
6,944 KB
testcase_42 AC 10 ms
6,940 KB
testcase_43 AC 10 ms
6,940 KB
testcase_44 AC 10 ms
6,940 KB
testcase_45 AC 10 ms
6,944 KB
testcase_46 AC 10 ms
6,940 KB
testcase_47 AC 10 ms
6,940 KB
testcase_48 AC 10 ms
6,940 KB
testcase_49 AC 18 ms
6,944 KB
testcase_50 AC 10 ms
6,940 KB
testcase_51 AC 10 ms
6,940 KB
testcase_52 AC 11 ms
6,940 KB
testcase_53 AC 9 ms
6,940 KB
testcase_54 AC 9 ms
6,944 KB
testcase_55 AC 10 ms
6,940 KB
testcase_56 AC 10 ms
6,940 KB
testcase_57 AC 9 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

double A, B, C;

double f(double x) {
  return x * x * x + A * x * x + B * x + C;
}

double solve(double l, double h) {
  double m;
  if(f(l) > 0) swap(l, h);
  REP(i, 0, 200000) {
    m = (l + h) / 2.0;
    if(f(m) > 0) h = m;
    else l = m;
  }
  return m;
}

ll floorll(double r) {
  ll ret = (ll) (r + 0.5);
  if(r < 0) ret--;
  return ret;
}

int main(void) {
  cin >> A >> B >> C;

  double p = (-A - sqrt(A * A - B * 3.0)) / 3.0;
  double q = (-A + sqrt(A * A - B * 3.0)) / 3.0;

  double a = solve(-1e10, p);
  double b = solve(p, q);
  double c = solve(q, 1e10);

  cout << floorll(a) << " " << floorll(b) << " " << floorll(c) << endl;
}
0