标签:names const clu set for ret mes namespace 差值
#include<bits/stdc++.h>
using namespace std;
const int MAXV = 100010;
int num[MAXV];
bool cmp(int a, int b){
return a < b;
}
int main(){
int N, S1 = 0, S2 = 0;
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d", &num[i]);
}
sort(num, num + N, cmp);
for(int i = 0; i < N/2; i++){
S1 += num[i];
}
for(int i = N/2; i < N; i++){
S2 += num[i];
}
if(N % 2 == 0){
printf("0 %d", S2-S1);
}else{
printf("1 %d", S2-S1);
}
return 0;
}
A1113 Integer Set Partition (25分)
标签:names const clu set for ret mes namespace 差值
原文地址:https://www.cnblogs.com/tsruixi/p/12983844.html