Submission #61284

# Submission time Handle Problem Language Result Execution time Memory
61284 2018-07-25T14:55:56 Z naderjemel Prosjek (COCI18_prosjek) C++14
50 / 50
16 ms 640 KB
#include <bits/stdc++.h>
using namespace std;


int main() {
    int n; scanf("%d",&n);
    vector<int> ns;
    for(int i=0;i<n;i++){
        int a; scanf("%d",&a);
        ns.push_back(a);
    }sort(ns.begin(),ns.end());
    if(n==1){
        printf("%d\n", ns[0]);
        return 0;
    }
    double rs=(double)(ns[0]+ns[1])/2.0;
    for(int i=2;i<n;i++){
        rs=((double)ns[i]+rs)/2.0;
    }
    printf("%.6f\n", rs);
    return 0;
}

Compilation message

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