多项式时间算法使右手总和与左手总和的组合相等?

Polynomial Time algorithm to equate combination of right hand sum to left hand sum?

我必须为这个问题编写多项式时间算法,如果左边的数字与右边的数字不匹配,应该说接受或拒绝。 您也可以对数字进行分组,示例如下

X & Y .......... & N = SUM where X, Y, and N can be any integer

Case 1: 4 & 6 & 10 = 14 , accepts 
So case 1 accepts because first number and the third number together sum up to 14.  
Case 2: 4 & 6 & 10 = 8 rejects
Case 3: 4 & 6 & 10 = 6 , accepts 
Case 4: 4 & 6 & 10 = 11 rejects

Some more test cases:
Case 1: 4 & 6 & 10 = 4 , accepts 
Case 2: 4 & 6 & 10 = 21 rejects
Case 3: 4 & 6 & 10 = 20 , accepts 
Case 4: 4 & 6 & 10 = 17 rejects
Case 5: 4 & 6 & 10 = 16 , accepts 
Case 6: 4 & 6 & 10 = 200 rejects

Case 7: 4 & 6 & 10 = 111 , rejects 
Case 8: 4 & 6 & 10 = 7 rejects

some more test cases 

Case 1 : 1 & 1 & 1 = 3 accepts
Case 2 : 1 & 1 & 1 & 2 & 2 & 22 = 29 accepts

为此我该如何编写多项式时间算法? 是NP问题吗?

在我看来,这也是子集求和问题,它是 NP-完整的(意味着多项式时间解不存在,除非 P=NP)但是 can be solved in pseudo-polynomial time(即数字数量和总和的的时间多项式)使用动态规划。