Submission #739996

#TimeUsernameProblemLanguageResultExecution timeMemory
739996unexpectedbroAkcija (COCI15_akcija)C++14
80 / 80
20 ms1236 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:16: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   int n; scanf ("%d", &n);
      |          ~~~~~~^~~~~~~~~~
akcija.cpp:17:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf ("%d", &C[i]);
      |     ~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...