結果

問題 No.236 鴛鴦茶
ユーザー tentententen
提出日時 2022-09-12 12:58:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,365 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 73,628 KB
実行使用メモリ 51,416 KB
最終ジャッジ日時 2023-08-19 17:03:44
合計ジャッジ時間 5,163 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
50,992 KB
testcase_01 AC 52 ms
50,752 KB
testcase_02 AC 56 ms
50,740 KB
testcase_03 AC 54 ms
51,064 KB
testcase_04 AC 55 ms
50,752 KB
testcase_05 AC 55 ms
50,944 KB
testcase_06 AC 57 ms
51,092 KB
testcase_07 AC 55 ms
50,724 KB
testcase_08 AC 57 ms
50,864 KB
testcase_09 AC 52 ms
50,932 KB
testcase_10 AC 57 ms
49,076 KB
testcase_11 AC 54 ms
50,988 KB
testcase_12 AC 54 ms
51,020 KB
testcase_13 AC 53 ms
50,956 KB
testcase_14 AC 56 ms
50,884 KB
testcase_15 AC 55 ms
51,080 KB
testcase_16 AC 53 ms
50,912 KB
testcase_17 AC 54 ms
51,416 KB
testcase_18 AC 54 ms
50,688 KB
testcase_19 AC 54 ms
51,044 KB
testcase_20 AC 56 ms
51,004 KB
testcase_21 AC 54 ms
51,008 KB
testcase_22 AC 53 ms
50,884 KB
testcase_23 AC 53 ms
50,760 KB
testcase_24 AC 53 ms
50,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        double left = 0;
        double right = x + y;
        for (int i = 0; i < 1000000; i++) {
            double m = (left + right) / 2;
            if (m * a / (a + b) <= x && m * b / (a + b) <= y) {
                left = m;
            } else {
                right = m;
            }
        }
        System.out.println(left);
    }
}
    
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0