# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
90788 | BabinSinko | Pareto (COCI17_pareto) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
using namespace std;
float r[300003], a, b, m, ma, mb, mon, mmon, n;
int main() {
cin >> n;
for (int i = 0; i < n; i++){
cin >> r[i];
mon += r[i];
}
while (m == 0){
m = 1;
for(int i = 0; i < (n-1); i++){
if (r[i] < r[i+1]){
m = r[i];
r[i] = r[i + 1];
r[i+1] = m;
m = 0;
}
}
}
for (float i = 1; i < n + 1; i++){
mmon += r[i-1];
a = (i * 100) / n;
b = mmon * 100 / mon;
if(b - a > mb - ma){
ma = a;
mb = b;
}
}
cout << ma << endl << mb;
return 0;
}