Click
Here to go back to the homepage.
Inflation Solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef TESTING
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int n_balloons;
cin >> n_balloons;
int balloons[n_balloons];
for(int i = 0; i < n_balloons; i++){
cin >> balloons[i];
}
sort(balloons, balloons + n_balloons);
double smallest = 1;
for(int i = 1; i <= n_balloons; i++){
if(balloons[i - 1] > i){
cout << "impossible" << endl;
return 0;
}
double fraction = balloons[i - 1] / (double) i;
if(fraction < smallest){
smallest = fraction;
}
}
cout << fixed << setprecision(7);
cout << smallest << endl;
return 0;
}