結果

問題 No.453 製薬会社
ユーザー ei1333333ei1333333
提出日時 2016-12-04 00:40:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 1,290 ms
コンパイル使用メモリ 144,292 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 12:17:51
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

// X = 4x/3 [y = (x/3)]

// Y = min(7x/2, 7y/5)
//
// 1000X+2000Y=Z(maximalize)

//

double x, y;

double calc(double a)
{
  return (4 * a / 3 * 1000 + min(7 * (x - a) / 2, 7 * (y - a / 3) / 5) * 2000);
}

int main()
{
  cin >> x >> y;

  double low = 0, high = min(x, y * 3);
  for(int i = 0; i < 500; i++) {
    double l = (low * 2 + high) / 3;
    double r = (low + high * 2) / 3;
    if(calc(l) < calc(r)) low = l;
    else high = r;
  }
  cout << fixed << setprecision(10) << calc(low) << endl;
}
0