제출 #959031

#제출 시각아이디문제언어결과실행 시간메모리
959031MilosMilutinovicProsjek (COCI18_prosjek)C++14
0 / 50
1 ms600 KiB
#include<bits/stdc++.h> #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;} template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;} ll readint(){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int n; int main(){ n=readint(); vector<ld> vec; for(int i=1;i<=n;i++){ int x=readint(); vec.pb(x); } while(vec.size()>1){ sort(vec.rbegin(),vec.rend()); ld x=vec[vec.size()-1],y=vec[vec.size()-2]; vec.pop_back(); vec.pop_back(); vec.pb((x+y)/2.00); } printf("%.6lf\n",vec[0]); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

prosjek.cpp: In function 'int main()':
prosjek.cpp:42:14: warning: format '%lf' expects argument of type 'double', but argument 2 has type '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' {aka 'long double'} [-Wformat=]
   42 |  printf("%.6lf\n",vec[0]);
      |          ~~~~^
      |              |
      |              double
      |          %.6Lf
#Verdict Execution timeMemoryGrader output
Fetching results...