답안 #858354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858354 2023-10-08T08:30:50 Z ily2003 Akcija (COCI15_akcija) C++14
80 / 80
12 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;
int n,tong,dem,a[100001];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n;
    for (int i=1;i<=n;++i) cin >> a[i];
    sort(a+1,a+n+1);
    for (int i=1;i<=n%3;++i) tong+=a[i];
    dem=2;
    for (int i=n%3+1;i<=n;++i) {
        ++dem;
        if (dem==3) {
            dem=0;
            continue;
        }
        tong+=a[i];
    }
    cout << tong;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 10 ms 1112 KB Output is correct
7 Correct 6 ms 1240 KB Output is correct
8 Correct 6 ms 1112 KB Output is correct
9 Correct 12 ms 1372 KB Output is correct
10 Correct 12 ms 1372 KB Output is correct