1113 Integer Set Partition(25 分)

#include
#include
#include
#include
using namespace std;

int main()
{
    int M,a;
    cin >> M;
    vectorv;
    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 分))