Submission #146951

# Submission time Handle Problem Language Result Execution time Memory
146951 2019-08-26T18:25:15 Z ronaldo_k Prosjek (COCI18_prosjek) C++14
50 / 50
2 ms 380 KB
#include <stdio.h>
#include <algorithm>

using namespace std;

const int MAXN = 30;
int n;
double v[MAXN];

int main() {
	scanf("%d", &n);

	for(int i = 0; i < n; i++) {
		scanf("%lf", &v[i]);
	}

	sort(v, v + n);

	for(int i = 1; i < n; i++) {
		v[i] = (v[i] + v[i-1])/2;
	}

	printf("%.6lf\n", v[n-1]);
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
prosjek.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf", &v[i]);
   ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct