제출 #90794

#제출 시각아이디문제언어결과실행 시간메모리
90794BabinSinkoPareto (COCI17_pareto)C++14
50 / 80
1084 ms2628 KiB
#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];
}
m = -1;
for (int i = 0; i < n; i++){
	for (int j = i; j < n; j++){
		if (r[i] < r[j]){
			m = r[i];
			r[i] = r[j];
			r[j] = m;
			m = -1;
		}
	}
}
for (int 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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...