結果

問題 No.236 鴛鴦茶
ユーザー jimanojimano
提出日時 2018-06-24 14:02:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 894 bytes
コンパイル時間 4,597 ms
コンパイル使用メモリ 72,252 KB
実行使用メモリ 49,804 KB
最終ジャッジ日時 2023-09-13 13:38:44
合計ジャッジ時間 6,789 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,576 KB
testcase_01 AC 43 ms
49,480 KB
testcase_02 AC 44 ms
49,492 KB
testcase_03 AC 43 ms
49,464 KB
testcase_04 AC 44 ms
49,364 KB
testcase_05 AC 43 ms
49,308 KB
testcase_06 AC 44 ms
49,456 KB
testcase_07 AC 44 ms
49,456 KB
testcase_08 AC 43 ms
49,368 KB
testcase_09 AC 43 ms
49,372 KB
testcase_10 AC 45 ms
49,456 KB
testcase_11 AC 43 ms
49,804 KB
testcase_12 AC 43 ms
49,620 KB
testcase_13 AC 43 ms
47,800 KB
testcase_14 AC 43 ms
49,556 KB
testcase_15 AC 43 ms
49,772 KB
testcase_16 AC 43 ms
49,496 KB
testcase_17 AC 45 ms
49,520 KB
testcase_18 AC 47 ms
49,356 KB
testcase_19 AC 45 ms
49,532 KB
testcase_20 WA -
testcase_21 AC 44 ms
49,372 KB
testcase_22 AC 44 ms
47,660 KB
testcase_23 AC 46 ms
49,508 KB
testcase_24 AC 44 ms
49,416 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(amount);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0