답안 #163864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
163864 2019-11-15T18:40:12 Z beso123 Akcija (COCI15_akcija) C++14
80 / 80
59 ms 1656 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,a[100001];
main(){
cin>>n;
for(int k=1;k<=n;k++)
    cin>>a[k];
int ans=0;
sort(a+1,a+n+1);
reverse(a+1,a+n+1);
for(int k=1;k<=n;k++)
    if(k%3!=0)
        ans+=a[k];
    cout<<ans;
return 0;
}

Compilation message

akcija.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
akcija.cpp: In function 'int main()':
akcija.cpp:12:1: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 for(int k=1;k<=n;k++)
 ^~~
akcija.cpp:15:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     cout<<ans;
     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 46 ms 1528 KB Output is correct
7 Correct 40 ms 1532 KB Output is correct
8 Correct 41 ms 1576 KB Output is correct
9 Correct 58 ms 1656 KB Output is correct
10 Correct 59 ms 1656 KB Output is correct