Submission #253212

#TimeUsernameProblemLanguageResultExecution timeMemory
253212nandonathanielProsjek (COCI18_prosjek)C++14
50 / 50
0 ms256 KiB
#include<bits/stdc++.h> using namespace std; double a[25]; int main(){ int n; double ans; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%lf",&a[i]); } sort(a+1,a+n+1); ans=(a[1]+a[2])/2.0; for(int i=3;i<=n;i++){ ans=(ans+a[i])/2.0; } printf("%.6lf\n",ans); return 0; }

Compilation message (stderr)

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