結果
| 問題 |
No.453 製薬会社
|
| ユーザー |
|
| 提出日時 | 2016-12-04 12:48:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 466 ms / 2,000 ms |
| コード長 | 1,137 bytes |
| コンパイル時間 | 3,523 ms |
| コンパイル使用メモリ | 77,832 KB |
| 実行使用メモリ | 41,320 KB |
| 最終ジャッジ日時 | 2024-11-27 19:43:54 |
| 合計ジャッジ時間 | 9,369 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 |
ソースコード
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);
}
}
}