結果

問題 No.236 鴛鴦茶
ユーザー jimanojimano
提出日時 2018-02-04 22:01:45
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 946 bytes
コンパイル時間 3,239 ms
コンパイル使用メモリ 73,880 KB
実行使用メモリ 50,128 KB
最終ジャッジ日時 2023-09-10 22:14:26
合計ジャッジ時間 5,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,588 KB
testcase_01 AC 47 ms
49,492 KB
testcase_02 AC 47 ms
49,624 KB
testcase_03 AC 46 ms
47,496 KB
testcase_04 AC 47 ms
49,768 KB
testcase_05 AC 47 ms
49,720 KB
testcase_06 AC 47 ms
49,596 KB
testcase_07 AC 47 ms
49,968 KB
testcase_08 AC 46 ms
49,652 KB
testcase_09 AC 47 ms
49,708 KB
testcase_10 AC 46 ms
49,768 KB
testcase_11 AC 48 ms
49,968 KB
testcase_12 AC 48 ms
50,128 KB
testcase_13 AC 46 ms
49,712 KB
testcase_14 AC 47 ms
49,768 KB
testcase_15 AC 49 ms
49,704 KB
testcase_16 AC 48 ms
50,052 KB
testcase_17 AC 46 ms
49,760 KB
testcase_18 AC 47 ms
49,772 KB
testcase_19 AC 48 ms
49,596 KB
testcase_20 WA -
testcase_21 AC 46 ms
49,672 KB
testcase_22 AC 47 ms
49,568 KB
testcase_23 AC 46 ms
49,688 KB
testcase_24 AC 47 ms
49,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1_5;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class No0098 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] str = br.readLine().split(" ");
			double a = Double.parseDouble(str[0]);
			double b = Double.parseDouble(str[1]);
			double x = Double.parseDouble(str[2]);
			double y = Double.parseDouble(str[3]);
			double amount = 0;

			double ratioA = a / (a + b);
			double ratioX = x / (x + y);

			if (ratioA > ratioX) {
				amount = x / a * b + x;
			} else if (ratioA < ratioX) {
				amount = y / b * a + y;
			} else {
				amount = (x >= y) ? 2 * y : 2 * x;
			}

			System.out.println(new BigDecimal(amount).setScale(7, RoundingMode.HALF_EVEN));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0