Submission
Status:
[PP][P][P][P][P]
Subtask/Task Score:
{20/20}{20/20}{20/20}{20/20}{20/20}
Score: 100
User: lumppengae
Problemset: ติดตั้งหลอดไฟ
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-30 15:10:32
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int k;
cin>>k;
int j[k];
for(int i=0;i<k;i++){
cin>>j[i];
}
sort(j,j+k);
int r=0;
for(int i=0;i<=k;i++){
for(int o=0;o<i;o++){
r+=2*j[o];
}
}
cout<<r;
}