結果
問題 | No.453 製薬会社 |
ユーザー | Grenache |
提出日時 | 2016-12-04 12:44:01 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 746 ms / 2,000 ms |
コード長 | 1,129 bytes |
コンパイル時間 | 6,053 ms |
コンパイル使用メモリ | 74,264 KB |
実行使用メモリ | 56,148 KB |
最終ジャッジ日時 | 2023-08-18 14:07:41 |
合計ジャッジ時間 | 13,523 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 724 ms
55,924 KB |
testcase_01 | AC | 688 ms
55,980 KB |
testcase_02 | AC | 740 ms
55,876 KB |
testcase_03 | AC | 713 ms
56,148 KB |
testcase_04 | AC | 623 ms
55,668 KB |
testcase_05 | AC | 622 ms
56,028 KB |
testcase_06 | AC | 689 ms
55,700 KB |
testcase_07 | AC | 739 ms
54,024 KB |
testcase_08 | AC | 701 ms
55,648 KB |
testcase_09 | AC | 744 ms
55,736 KB |
testcase_10 | AC | 746 ms
55,728 KB |
testcase_11 | AC | 689 ms
56,028 KB |
testcase_12 | AC | 733 ms
55,896 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; i++) { double x = (double)c * i / 1_000_000; 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); } } }