Submission #782342

#TimeUsernameProblemLanguageResultExecution timeMemory
782342alenterProsjek (COCI18_prosjek)C++14
50 / 50
1 ms304 KiB
#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 (stderr)

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]);
      |         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...