Never had to deal with the DP.
We have N stones with weights W_1,...,W_N. Need divide all stones for 2 parts, that difference between them was minimal.
As we have n = 6, and weight = 1,4,5,6,7,9 then difference is 0.
#include <iostream>
using namespace std;
int main()
{
int n; // numbers of stones
int* a; // array of weights
int diff=0;
cin >> n;
a = new int[n];
for(int i=0;i<n;i++)
cin >> a[i];
// And I don't know what's next, mee too
delete[] a;
system("PAUSE");
return 0;
}