How to divide a set into two subsets such that difference between the sum of numbers in two sets is minimal?

前端 未结 18 733
攒了一身酷
攒了一身酷 2020-11-27 10:55

Given a set of numbers, divide the numbers into two subsets such that difference between the sum of numbers in two subsets is minimal.

T

18条回答
  •  青春惊慌失措
    2020-11-27 11:40

    #include
    using namespace std;
    bool ison(int i,int x)
    {
     if((i>>x) & 1)return true;
     return false;
    }
    int main()
    {
    // cout<<"enter the number of elements  : ";
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i>a[i];
        int sumarr1[(1<v1[(1<v2[(1<

提交回复
热议问题