Submission #292360

#TimeUsernameProblemLanguageResultExecution timeMemory
292360MilosMilutinovicAkcija (COCI15_akcija)C++14
80 / 80
24 ms1280 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; scanf("%i",&n); int a[n]; long long sum=0; for(int i=0;i<n;i++)scanf("%i",&a[i]),sum+=a[i]; sort(a,a+n); reverse(a,a+n); for(int i=2;i<n;i+=3)sum-=a[i]; printf("%lld",sum); return 0; }

Compilation message (stderr)

akcija.cpp: In function 'int main()':
akcija.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    5 |     scanf("%i",&n);
      |     ~~~~~^~~~~~~~~
akcija.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(int i=0;i<n;i++)scanf("%i",&a[i]),sum+=a[i];
      |                         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...