제출 #799351

#제출 시각아이디문제언어결과실행 시간메모리
799351Tunglam07Autići (COCI22_autici)C++17
0 / 50
5 ms596 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; if(n==1) { cout << 0; return 0; } int sum,a[n+1]; for(int i=0;i<n;i++) { cin >> a[i]; sum+=a[i]; } sort(a,a+n); sum*=2; sum=sum-a[n-1]-a[n-2]; cout << sum; }

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

Main.cpp: In function 'int main()':
Main.cpp:23:5: warning: 'sum' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |  sum*=2;
      |  ~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...