結果
問題 | No.453 製薬会社 |
ユーザー | Grenache |
提出日時 | 2016-12-04 12:48:40 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 503 ms / 2,000 ms |
コード長 | 1,137 bytes |
コンパイル時間 | 4,446 ms |
コンパイル使用メモリ | 74,648 KB |
実行使用メモリ | 55,948 KB |
最終ジャッジ日時 | 2023-08-18 14:08:11 |
合計ジャッジ時間 | 11,101 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 485 ms
55,744 KB |
testcase_01 | AC | 478 ms
55,680 KB |
testcase_02 | AC | 496 ms
55,596 KB |
testcase_03 | AC | 493 ms
55,604 KB |
testcase_04 | AC | 438 ms
55,644 KB |
testcase_05 | AC | 435 ms
55,564 KB |
testcase_06 | AC | 475 ms
55,376 KB |
testcase_07 | AC | 497 ms
55,624 KB |
testcase_08 | AC | 474 ms
55,948 KB |
testcase_09 | AC | 497 ms
55,396 KB |
testcase_10 | AC | 503 ms
55,644 KB |
testcase_11 | AC | 478 ms
55,680 KB |
testcase_12 | AC | 496 ms
55,420 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder453 { private static Scanner sc; private static Printer pr; private static void solve() { int c = sc.nextInt(); int d = sc.nextInt(); double max = 0; for (int i = 0; i < 1_000_000 / 2; i++) { double x = (double)c * i / 1_000_000 * 2; double l = 0; double r = d; for (int j = 0; j < 40; j++) { double c1 = (l + l + r) / 3; double c2 = (l + r + r) / 3; if (f(c1, x, c, d) < f(c2, x, c, d)) { l = c1; } else { r = c2; } } max = Math.max(max, f(r, x, c, d)); } // pr.printf("%.7f\n", ret); pr.println(max); } private static double f(double y, double x, int c, int d) { double ret = Math.min(x * 4 / 3, y * 4) * 1000 + Math.min((c - x) * 7 / 2, (d - y) * 7 / 5) * 2000; return ret; } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }