結果
問題 | No.453 製薬会社 |
ユーザー | 37zigen |
提出日時 | 2016-12-04 01:07:57 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 138 ms / 2,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 4,029 ms |
コンパイル使用メモリ | 80,520 KB |
実行使用メモリ | 56,488 KB |
最終ジャッジ日時 | 2023-08-18 12:22:43 |
合計ジャッジ時間 | 6,191 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 138 ms
56,104 KB |
testcase_01 | AC | 137 ms
56,228 KB |
testcase_02 | AC | 138 ms
56,108 KB |
testcase_03 | AC | 136 ms
55,968 KB |
testcase_04 | AC | 136 ms
56,488 KB |
testcase_05 | AC | 138 ms
56,012 KB |
testcase_06 | AC | 137 ms
56,252 KB |
testcase_07 | AC | 135 ms
56,132 KB |
testcase_08 | AC | 137 ms
56,064 KB |
testcase_09 | AC | 138 ms
56,060 KB |
testcase_10 | AC | 135 ms
55,972 KB |
testcase_11 | AC | 136 ms
56,008 KB |
testcase_12 | AC | 137 ms
56,020 KB |
ソースコード
package yukicoder; import java.util.*; public class Q453 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double c = sc.nextDouble(); double d = sc.nextDouble(); /* * 1000x+2000y max 3/4x+2/7y<=c 1/4x+5/7y<=d */ double max = 0; ArrayDeque<Pair> que = new ArrayDeque<>(); que.add(new Pair(0, Math.min(7.0 / 2.0 * c, 7.0 / 5.0 * d))); que.add(new Pair(Math.min(4.0 / 3.0 * c, 4 * d), 0)); que.add(new Pair(4.0 / 13.0 * (5 * c - 2 * d), 7 * (3 * d - c) / 13.0)); while (!que.isEmpty()) { Pair p = que.poll(); if (p.x < 0 || p.y < 0) continue; max = Math.max(max, 1000 * p.x + 2000 * p.y); } System.out.println(max); } static class Pair { double x; double y; public Pair(double x, double y) { this.x = x; this.y = y; } } }