Maximization of Relational Expression (AOJ 0347) by letter
Contest: 3420    RunID: 2277087    Status: Accepted    Date: Sun Apr 23 15:48:28 JST 2017


#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false
 
typedef long long				ll;
typedef pair <int, int> ii;

int main() {
	
	int n;
	cin >> n;
	
	vector<int>a(n);
	rep(i, n) cin >> a[i];
	SORT(a);
	
	double ans = 0;
	
	for(int i  = n - 1; i > 0 ; i--){//C, D
		int bunnbo = a[i] - a[i - 1];
		int bunnsi;
		if(i == n - 1) bunnsi = a[n - 3] + a[n - 4];
		else if (i == n - 2) bunnsi = a[n - 1] + a[n - 4];
		else bunnsi = a[n - 1] + a[n - 2];
		ans = max(ans, (double)(1.0 * bunnsi / bunnbo ));
	}
	
	printf("%.6lf\n", ans);
	
	
	return 0;
}