1113 Integer Set Partition(25 分)
作者:
zjh3029 | 来源:发表于
2018-09-02 14:34 被阅读0次#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;
int main()
{
int M,a;
cin >> M;
vector<int>v;
for (int i = 0; i < M; i++)
{
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
int sum = 0,sum1=0;
if (M%2==0)
cout << 0 << " ";
else
cout << 1 << " ";
sum = accumulate(v.begin(), v.begin() + v.size() / 2, 0);
sum1 = accumulate(v.begin(), v.end(), 0);
cout << sum1 - sum*2 << endl;
system("pause");
return 0;
}
本文标题:1113 Integer Set Partition(25 分)
本文链接:https://www.haomeiwen.com/subject/sjeuwftx.html
网友评论