我遇到了难题,请帮帮忙
高手请帮帮忙,我有个题做不出来没有头绪,谢谢
划分问题:(用动态规划)
输入:A={a1,a2,…,an},其中ai∈Z+(1≤i≤n)
输出:是否存在P属于A,使∑ai=∑aj (ai∈P,aj∈A-P)
比方说A={1.3.8.4.10} 则输出P={1.8.4}
(1+8+4=3+10)
一、30个元素
a[]={21,5,38,11,10,17,15,27,25,42,22,8,26,13,16,37,1,24,31,19,2,14,28,3,33,23,43,20,12,14};
二、40个元素
a[]={46,10,33,17,16,23,41,48,28,45,22,11,44,9,15,46,8,40,37,13,34,30,29,20,6,41,15,10,25,22,17,19,8,7,21,38,31,14,49,12};