哪题?
by 神秘强者 @ 2017-05-18 13:09:29
你手动算算:
9
1 2 3 4 5 6 7 8 9
by szfcpp @ 2017-05-20 19:44:53
试试吧!
```cpp
#include<iostream>
#include <stdlib.h>
#include<algorithm>
using namespace std;
bool com(int x,int y) { return x>y; }
int main(){
freopen("p1027.in","r",stdin);
freopen("p1027.out","w",stdout);
int n,a[10000];
long long s=0;
int i,k,l=0,j,x,t;
cin>>n;
for(i=1;i<=n;i++)cin>>a[i];
```
/\*
```cpp
for(i=1;i<=n-1;i++)
for (j=1;j<=n-i;j++)
if(a[j]<a[j+1])
swap(a[j],a[j+1]);
```
\*/
```cpp
sort(a+1,a+n+1,com);
k=n;
while(k>1){
t=a[k]+a[k-1];
s+=t;
for(i=k-2;i>=0;i--){
if(a[i]>t||i==0){
for(j=k-2;j>i;j--)a[j+1]=a[j];
a[i+1]=t;
break;}
}
k--;
}
cout<<s;
return 0;
fclose(stdin);
fclose(stdout);
}
```
by hehehemc @ 2017-05-23 17:21:27
```cpp
#include<iostream>
#include <stdlib.h>
#include<algorithm>
using namespace std;
bool com(int x,int y) { return x>y; }
int main(){
int n,a[10000];
long long s=0;
int i,k,l=0,j,x,t;
cin>>n;
for(i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+n+1,com);
k=n;
while(k>1){
t=a[k]+a[k-1];
s+=t;
for(i=k-2;i>=0;i--){
if(a[i]>t||i==0){
for(j=k-2;j>i;j--)a[j+1]=a[j];
a[i+1]=t;
break;}
}
k--;
}
cout<<s;
return 0;
}
```
by hehehemc @ 2017-05-23 17:22:32
重发一遍
by hehehemc @ 2017-05-23 17:23:10
50分
by hehehemc @ 2017-05-23 17:24:27
```cpp
var
n,i,js,s:longint;
a:array[1..100000] of longint;
procedure qsort(l,r:longint);
var
i,j,m,t:longint;
begin
m:=a[(l+r) div 2];
i:=l;
j:=r;
while i<j do
begin
while a[i]<m do
inc(i);
while a[j]>m do
dec(j);
if i<=j then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
inc(i);
dec(j);
end;
end;
if i<r
then qsort(i,r);
if l<j
then qsort(l,j);
end;
begin
readln(n);
for i:=1 to n do
read(a[i]);
qsort(1,n);
for i:=1 to n do
begin
inc(js,a[i]);
inc(s,js);
end;
writeln(s-a[1]);
end.
十分代码
```
by Kidd @ 2017-06-06 14:10:33
消费者投诉举报专线电话考古!!
by 庄nnnn额 @ 2021-09-30 21:09:03
消费者投诉举报专线电话考古!!
by _8008008 @ 2023-01-05 17:57:17