結果
| 問題 | No.236 鴛鴦茶 |
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-08-21 21:46:26 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 672 bytes |
| 記録 | |
| コンパイル時間 | 553 ms |
| コンパイル使用メモリ | 84,684 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2026-03-17 06:35:28 |
| 合計ジャッジ時間 | 1,177 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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