結果

問題 No.236 鴛鴦茶
ユーザー spaciaspacia
提出日時 2015-12-29 21:15:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 71,172 KB
実行使用メモリ 49,372 KB
最終ジャッジ日時 2023-09-10 21:59:10
合計ジャッジ時間 5,088 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,124 KB
testcase_01 AC 43 ms
49,068 KB
testcase_02 AC 42 ms
49,316 KB
testcase_03 AC 43 ms
48,884 KB
testcase_04 AC 43 ms
49,156 KB
testcase_05 AC 43 ms
49,152 KB
testcase_06 AC 42 ms
49,148 KB
testcase_07 AC 43 ms
49,096 KB
testcase_08 AC 43 ms
48,884 KB
testcase_09 AC 43 ms
49,172 KB
testcase_10 AC 43 ms
49,080 KB
testcase_11 AC 44 ms
48,908 KB
testcase_12 AC 43 ms
47,424 KB
testcase_13 AC 44 ms
49,160 KB
testcase_14 AC 43 ms
49,036 KB
testcase_15 AC 43 ms
49,248 KB
testcase_16 AC 43 ms
49,076 KB
testcase_17 AC 43 ms
49,076 KB
testcase_18 AC 43 ms
49,296 KB
testcase_19 AC 43 ms
49,372 KB
testcase_20 AC 43 ms
49,076 KB
testcase_21 AC 43 ms
49,120 KB
testcase_22 AC 43 ms
49,280 KB
testcase_23 AC 43 ms
49,084 KB
testcase_24 AC 43 ms
49,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main236 {
	
	public static void out (Object out) {
		System.out.println(out);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);
		int x = Integer.parseInt(line[2]);
		int y = Integer.parseInt(line[3]);
		
		if (a < b) {
			double d = (double)y / b * a;
			out(d <= x ? y + d : x + ((double)x / a * b));
		} else if (b < a) {
			// 1000 999 999 998
			double d = (double)x / a * b;
			out(d <= y ? x + d : y + ((double)y / b * a));
		} else {
			out(Math.min(x , y) * 2);
		}
		
	}
}
0