답안 #76991

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
76991 2018-09-19T19:40:19 Z farukkastamonuda Prosjek (COCI18_prosjek) C++14
50 / 50
2 ms 632 KB
#include <bits/stdc++.h>
#define li 300005
using namespace std;
int n;
double x;
multiset<double> s;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lf",&x);
        s.insert(x);
    }
    while((int)s.size()>1){
       // cout<<"SIZE:"<<(int)s.size()<<endl;
        auto it=s.begin();
        double tut1=*it;
        auto it2=it;
        it2++;
        double tut2=*it2;
        s.erase(it);
        s.erase(it2);
        s.insert((tut1+tut2)/2);
    }
    printf("%.6lf",*s.begin());
    return 0;
}

Compilation message

prosjek.cpp: In function 'int main()':
prosjek.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
prosjek.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lf",&x);
         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 520 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 556 KB Output is correct
6 Correct 2 ms 568 KB Output is correct
7 Correct 2 ms 568 KB Output is correct
8 Correct 2 ms 568 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 632 KB Output is correct