#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int n;
vector<int> sq;
int getsum(int i,int j){
int sum=0;
for(i;i<=j;i++){
sum+=sq[i];
}
return sum;
}
int main(){
int i;
scanf("%d",&n);
int temp;
for(i=0;i<n;i++){
scanf("%d",&temp);
sq.push_back(temp);
}
sort(sq.begin(),sq.end());
int s1=0,s2=0,n1,n2;
s2=getsum(0,(n/2)-1);
s1=getsum((n/2),n-1);
if(n%2==0){
printf("0 ");
}
else{
printf("1 ");
}
printf("%d\n",abs(s1-s2));
system("pause");
return 0;
}
PAT A1113 integer set partition (25)
最新推荐文章于 2022-10-31 08:49:53 发布