Submission #253212

# Submission time Handle Problem Language Result Execution time Memory
253212 2020-07-27T12:20:04 Z nandonathaniel Prosjek (COCI18_prosjek) C++14
50 / 50
0 ms 256 KB
#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

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 time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 0 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct