답안 #165815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165815 2019-11-29T08:05:16 Z Abdulaziz_Kazim Akcija (COCI15_akcija) C++17
80 / 80
60 ms 760 KB
#include<bits/stdc++.h>
using namespace std;
int main()
{
	// freopen("a.gir","r",stdin);
	// freopen("a.cik","w",stdout);
	int n;
	int dizi[100007];
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> dizi[i];
	}
	sort(dizi,dizi+n);
	long long int fiyat=0;
	int i;
	for(i=0;i<n%3;i++)
	{
		fiyat+=dizi[i];
	}
	for(;i<n-2;i+=3)
	{
		fiyat+=dizi[i+1]+dizi[i+2];
	}
	cout << fiyat;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 45 ms 652 KB Output is correct
7 Correct 40 ms 644 KB Output is correct
8 Correct 39 ms 632 KB Output is correct
9 Correct 60 ms 760 KB Output is correct
10 Correct 58 ms 632 KB Output is correct