結果
| 問題 | 
                            No.236 鴛鴦茶
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hadrori
                         | 
                    
| 提出日時 | 2015-07-25 16:19:00 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 492 bytes | 
| コンパイル時間 | 1,400 ms | 
| コンパイル使用メモリ | 158,336 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 12:53:31 | 
| 合計ジャッジ時間 | 2,218 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 23 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repi(i,0,n)
int a, b, x, y;
double f(double z, double k) { return z>k? -1: z; }
double solve() {
    return max(f(1.*a/b*y, x)*(a+b)/a, f(1.*b/a*x, y)*(a+b)/b);
}
void input() {
    cin >> a >> b >> x >> y;
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout << fixed << setprecision(12);
    input();
    cout << solve() << endl;
    return 0;
}
            
            
            
        
            
hadrori