답안 #604060

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
604060 2022-07-24T16:21:34 Z hyakup Prosjek (COCI18_prosjek) C++17
0 / 50
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;


int main(){
    
    int n; scanf("%d", &n);
    
    multiset<double> s;
    
    for( int i = 0; i < n; i++){
        double g; scanf("%lf", &g);
        s.insert(g);
    }
    
    multiset<double>::iterator it, it2;
    for( it = s.begin(); it != s.end() ; it++){
        it2 = s.begin();
        
        if( it == s.begin() ) continue;
        
        s.insert(( *it + *it2 )/2 );
        
        s.erase(it);
        s.erase(it2);
        
    }
    
    printf("%lf", *(s.begin()) );
    
    
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:7:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     int n; scanf("%d", &n);
      |            ~~~~~^~~~~~~~~~
prosjek.cpp:12:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         double g; scanf("%lf", &g);
      |                   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Runtime error 1 ms 340 KB Execution killed with signal 11
3 Runtime error 1 ms 340 KB Execution killed with signal 11
4 Runtime error 1 ms 340 KB Execution killed with signal 11
5 Runtime error 1 ms 300 KB Execution killed with signal 11
6 Runtime error 1 ms 340 KB Execution killed with signal 11
7 Runtime error 1 ms 340 KB Execution killed with signal 11
8 Runtime error 1 ms 340 KB Execution killed with signal 11
9 Runtime error 1 ms 340 KB Execution killed with signal 11
10 Runtime error 1 ms 340 KB Execution killed with signal 11