Submission #23191

#TimeUsernameProblemLanguageResultExecution timeMemory
23191model_codeAkcija (COCI15_akcija)C++11
80 / 80
23 ms1504 KiB
#include <cstdio> #include <algorithm> using namespace std; #define MAXN 100000 typedef long long llint; int C[MAXN]; bool cmp(int a, int b) { return a > b; } int main(void) { int n; scanf ("%d", &n); for (int i = 0; i < n; i++) { scanf ("%d", &C[i]); } sort(C, C+n, cmp); llint sol = 0; for (int i = 0; i < n; i++) { if (i % 3 == 2) { continue; } sol += C[i]; } printf ("%lld\n", sol); return 0; }

Compilation message (stderr)

akcija.cpp: In function 'int main()':
akcija.cpp:15:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int n; scanf ("%d", &n);
                          ^
akcija.cpp:17:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d", &C[i]);
                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...