제출 #1209867

#제출 시각아이디문제언어결과실행 시간메모리
1209867talyProsjek (COCI18_prosjek)C++20
50 / 50
0 ms328 KiB
#include <bits/stdc++.h>
 // #include <algorithm>
using namespace std;


int main() {
    int n;
    (void)scanf("%d", &n);
    vector<double> grades(n);
    for (int i=0; i < n; i++){
        (void)scanf("%lf", &grades[i]);
    }
    sort(grades.begin(), grades.end());
    double ultimo = grades[0];
    for (int i=1; i < n; i++){
        ultimo = (ultimo+grades[i])/2;
    }
    printf("%lf", ultimo);

    return 0;
}

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

prosjek.cpp: In function 'int main()':
prosjek.cpp:8:16: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     (void)scanf("%d", &n);
      |           ~~~~~^~~~~~~~~~
prosjek.cpp:11:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         (void)scanf("%lf", &grades[i]);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...