답안 #392371

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
392371 2021-04-20T23:04:13 Z Gamma Prosjek (COCI18_prosjek) C++14
0 / 50
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;
int n;
double a[21];
int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    for(int i = 1; i < n; i++)
    {
        //cout << a[i] << ' ';
        a[i] = (a[i] + a[i - 1]) / 2.0;
    }
    printf("%llf\n", a[n - 1]);
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:19:16: warning: use of 'll' length modifier with 'f' type character has either no effect or undefined behavior [-Wformat=]
   19 |     printf("%llf\n", a[n - 1]);
      |                ^
prosjek.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Expected double, but "nan" found
2 Incorrect 1 ms 204 KB Expected double, but "nan" found
3 Incorrect 1 ms 204 KB Expected double, but "nan" found
4 Incorrect 1 ms 204 KB Expected double, but "nan" found
5 Incorrect 1 ms 204 KB Expected double, but "nan" found
6 Incorrect 1 ms 204 KB Expected double, but "nan" found
7 Incorrect 1 ms 204 KB Expected double, but "nan" found
8 Incorrect 1 ms 204 KB Expected double, but "nan" found
9 Incorrect 1 ms 204 KB Expected double, but "nan" found
10 Incorrect 1 ms 204 KB Expected double, but "nan" found