Submission #603287

# Submission time Handle Problem Language Result Execution time Memory
603287 2022-07-23T21:31:03 Z LucaGreg Prosjek (COCI18_prosjek) C++17
50 / 50
1 ms 304 KB
#include <bits/stdc++.h>

using namespace std;

vector<int> v;

int main()
{
    int n; scanf("%d", &n);
    for(int i=0;i<n;i++){
        int vi; scanf("%d", &vi);
        v.push_back(vi);
    }
    sort(v.begin(), v.end());
    double m = v[0];
    for(int i=1;i<=n-1;i++){
        m = (m + v[i])/2;
    }
    printf("%f", m);
    
    return 0;
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:10:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     int n; scanf("%d", &n);
      |            ~~~~~^~~~~~~~~~
prosjek.cpp:12:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         int vi; scanf("%d", &vi);
      |                 ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct