Submission #948896

# Submission time Handle Problem Language Result Execution time Memory
948896 2024-03-18T15:59:41 Z andrei_marciuc Prosjek (COCI18_prosjek) C++14
50 / 50
1 ms 408 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:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%hd", &n);
      |     ~~~~~^~~~~~~~~~~
prosjek.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%hd", &i);
      |         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 408 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct