You are viewing a single comment's thread. Return to all comments →
public static void solve(int n, List a) {
Collections.sort(a); double sum = 0; for(int an : a){ sum+= an; } int k = a.size(); double ans = a.get(0); for(int i = k - 1; i >= 0; i --) { if(sum / (n - (k - 1 - i)) > a.get(i)) { ans = sum / (n - (k - 1 - i)); break; } sum -= a.get(i); } System.out.println(ans); }
Seems like cookies are disabled on this browser, please enable them to open this website
Save the Queen!
You are viewing a single comment's thread. Return to all comments →
public static void solve(int n, List a) {