Submission #835260

# Submission time Handle Problem Language Result Execution time Memory
835260 2023-08-23T11:18:22 Z EntityPlantt Prosjek (COCI18_prosjek) C++14
50 / 50
0 ms 284 KB
#include <cstdio>
short n, a[5], i;
double r;
int main() {
    scanf("%hd", &n);
    while (n--) {
        scanf("%hd", &i);
        a[--i]++;
    }
    for (i = 0; !a[i]; i++);
    r = ++i;
    while (true) {
        while (i < 5 && !a[i]) i++;
        if (i > 4) break;
        r = (r + i + 1) / 2.0; a[i]--;
    }
    printf("%lf", r);
    return 0;
}

Compilation message

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