제출 #82682

#제출 시각아이디문제언어결과실행 시간메모리
82682heonPareto (COCI17_pareto)C++11
30 / 80
75 ms1792 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; scanf("%d", &n); vector <int> v(n); int sum = 0; for(int i = 0; i < n; i++){ scanf("%d", &v[i]); sum += v[i]; } sort(v.rbegin(), v.rend()); int curr = 0; double a, b; double solb = 0.0, sola = 0.0; for(int i = 0; i < n; i++){ curr += v[i]; a = (double) (i+1) / n; b = (double) curr / sum; if(b - a > solb - sola){ solb = b, sola = a; } } cout << fixed << setprecision(14) << sola * 100 << "\n"; cout << fixed << setprecision(14) << solb * 100; }

컴파일 시 표준 에러 (stderr) 메시지

pareto.cpp: In function 'int main()':
pareto.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
pareto.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...