답안 #739996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739996 2023-05-11T19:56:14 Z unexpectedbro Akcija (COCI15_akcija) C++14
80 / 80
20 ms 1236 KB
#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

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]);
      |     ~~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 16 ms 980 KB Output is correct
7 Correct 12 ms 980 KB Output is correct
8 Correct 12 ms 1024 KB Output is correct
9 Correct 19 ms 1124 KB Output is correct
10 Correct 20 ms 1236 KB Output is correct