結果

問題 No.236 鴛鴦茶
ユーザー apprec
提出日時 2015-07-06 11:36:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 1,344 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 23,552 KB
最終ジャッジ日時 2024-06-28 12:51:50
合計ジャッジ時間 3,419 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Text.RegularExpressions;

namespace YukiCoder.No236 {
    class CoffeeTea {
        public static void Main() {
            var scn = new Scanner(Console.In);
            int[] a = scn.NextIntAry();
            int A = a[0], B = a[1], X = a[2], Y = a[3];

            double productMax = 0;
            if (A*Y >= B*X) { // coffee <= tea
                productMax = X * (A + B) / (double)A;
            } else {// coffee > tea
                productMax =  Y * (B + A) / (double)B;
            }

            Console.WriteLine("{0:F12}", productMax);
        }
    }

    public class Scanner {
        private TextReader tr;

        public Scanner(TextReader tr) {
            this.tr = tr;
        }

        public Scanner(string filePath) {
            this.tr = new StreamReader(filePath);
        }

        private string readLine() {
            return Regex.Replace(tr.ReadLine(), @"\s+", " ").Trim();
        }

        public string NextStr() {
            return readLine();
        }

        public string[] NextStrAry() {
            return readLine().Split(' ');
        }

        public int NextInt() {
            return int.Parse(readLine());
        }

        public int[] NextIntAry() {
            return Array.ConvertAll(readLine().Split(' '), int.Parse);
        }
    }
}
0