제출 #604127

#제출 시각아이디문제언어결과실행 시간메모리
604127Hussein3600Akcija (COCI15_akcija)C++14
40 / 80
20 ms704 KiB
#include<bits/stdc++.h> using namespace std ; typedef long long ll ; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n ; cin >> n ; int a[n] , total=0 , best ; for(int i=0;i<n;i++)cin>>a[i] ,total+=a[i]; sort(a,a+n) ; for(int i=0;i<n;i+=3)total-=a[i] ; if(n%3==0) cout<<total<<endl; else cout<<total+a[n-1]; }

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

akcija.cpp: In function 'int main()':
akcija.cpp:9:26: warning: unused variable 'best' [-Wunused-variable]
    9 |     int a[n] , total=0 , best ;
      |                          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...