結果
| 問題 | No.236 鴛鴦茶 |
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-08-21 21:46:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 672 bytes |
| コンパイル時間 | 481 ms |
| コンパイル使用メモリ | 63,620 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 12:55:38 |
| 合計ジャッジ時間 | 1,323 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
#include<iostream>
#include<algorithm>
#include<iomanip>
int main() {
double coffee_ratio, tea_ratio, total_coffee, total_tea;
std::cin >> coffee_ratio >> tea_ratio >> total_coffee >> total_tea;
double coffee = total_tea * coffee_ratio / tea_ratio;
double tea = total_coffee * tea_ratio / coffee_ratio;
double enoutea = 0.0;
if (coffee > total_coffee) {
enoutea = tea + tea * coffee / total_tea;
} else if (tea > total_tea) {
enoutea = coffee + coffee * tea / total_coffee;
} else {
enoutea = std::max(tea + tea * coffee / total_tea, coffee + coffee * tea / total_coffee);
}
std::cout << std::fixed << std::setprecision(6) << enoutea << std::endl;
}
hanorver