結果
問題 | No.453 製薬会社 |
ユーザー |
|
提出日時 | 2016-12-04 01:07:57 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 137 ms / 2,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 3,456 ms |
コンパイル使用メモリ | 78,000 KB |
実行使用メモリ | 41,712 KB |
最終ジャッジ日時 | 2024-11-27 17:23:05 |
合計ジャッジ時間 | 5,896 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 |
ソースコード
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; } } }