답안 #782342

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
782342 2023-07-13T20:21:58 Z alenter Prosjek (COCI18_prosjek) C++14
50 / 50
1 ms 304 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    scanf("%d",&N);
    int v[N];
    for(int i=0;i<N;i++){
        scanf("%d",&v[i]);
    }
    sort(v,v+N);
    int b;
    int aux = 1;
    double ans;
    if(N<2){
        printf("%d",v[0]);
    }else{
        ans = (v[0]+v[1]);
        ans = ans/2;
        while(aux<N-1){
            b = v[aux+1];
            ans = (ans+b)/2;
            aux++;
        }
        printf("%f",ans);
    }
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
prosjek.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf("%d",&v[i]);
      |         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 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 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct