这里是伪代码。
1)一个负数列表并排序
2)一个postivie数字列表并排序
3)迭代并以负列表中的最大数字开始
4)检查肯定列表中等号或小号的索引
5)使用此索引迭代肯定列表:
a) if current positive number
1) equal to negative number - nullify and put them in map, go to next negative number
2) else if less than negative number -
i) get the difference of this positive number and the negative number
ii) create a variable for this difference and put it in while loop
iii) search for the index of the number equal to or lesser to this difference.
iv) get the second positive number and if is
a) equal to difference, nullify all by updatng index of the negative and two positives numbers as NA
update difference to 0 and exit while and go to next negative number
b) else if the second positive number is less than the difference, sum the two numbers and negative number
and get the difference and update the difference variable with this new value and iterate while loop
c) if there is no lesser or mathcing number equal to difference,
come out of while and pick the next element in positive list as done in step (v) and get next number
and repeat further.
看看你现在能不能帮助我......