結果

問題 No.236 鴛鴦茶
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-07 16:50:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 3,040 ms
コンパイル使用メモリ 72,232 KB
実行使用メモリ 56,076 KB
最終ジャッジ日時 2023-09-10 22:04:25
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
53,744 KB
testcase_01 AC 122 ms
55,760 KB
testcase_02 AC 124 ms
55,708 KB
testcase_03 AC 123 ms
55,488 KB
testcase_04 AC 124 ms
55,800 KB
testcase_05 AC 123 ms
55,672 KB
testcase_06 AC 123 ms
55,628 KB
testcase_07 AC 124 ms
55,892 KB
testcase_08 AC 123 ms
55,428 KB
testcase_09 AC 123 ms
56,076 KB
testcase_10 AC 123 ms
55,556 KB
testcase_11 AC 124 ms
55,792 KB
testcase_12 AC 123 ms
55,652 KB
testcase_13 AC 123 ms
55,612 KB
testcase_14 AC 123 ms
55,532 KB
testcase_15 AC 122 ms
55,804 KB
testcase_16 AC 122 ms
55,656 KB
testcase_17 AC 122 ms
55,756 KB
testcase_18 AC 121 ms
55,472 KB
testcase_19 AC 121 ms
53,864 KB
testcase_20 AC 123 ms
55,440 KB
testcase_21 AC 123 ms
55,904 KB
testcase_22 AC 123 ms
55,852 KB
testcase_23 AC 123 ms
55,672 KB
testcase_24 AC 123 ms
55,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise66{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    double a = sc.nextInt();

    double b = sc.nextInt();

    double x = sc.nextInt();

    double y = sc.nextInt();

    double sum = 0;

    if(a == b){
      double min = Math.min(x, y);
      sum = min * 2;
      int sumd = (int)sum;
      System.out.println(sumd);
    }else{
      double xd = (y * a) / b;
      if (xd > x){
        double yd = (x * b) /a;
        sum = x + yd;
      }else{
        sum = y + xd;
      }
      System.out.println(sum);
    }
  }
}
0