none
求助:找两个浮点数组中各项的相等关系

    问题

  • 有两个浮点数数组,两个数组的长度不一定相等,两个数组的各项的合计相等。如何能迅速找到两个数组中各项的相等关系,优先找一对一,然后是一对二、一定三……,最后是多对多
     比如:
    A = { 30, 20, 80 }
     B = { 20, 30, 45, 35}
    应该找到:
    A[1]  = B[2]
     A[2]  = B[1]
     A[3] = B[3] + B[4]
    2016年1月13日 7:44

答案

  • 你好,老邸

    获取一对一的很简单,而这个问题的一个关键点是如何找到一对多的关系,针对这个问题你可以参考如下这个类似的帖子。

    http://bbs.csdn.net/topics/391884847

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Albert Zhang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2016年1月14日 7:14

全部回复

  • 我的想法是先找到一对一的,并从A、B中剔除这些项。然后在将剩余项从2到n-1组合的合计计算出来再比较,但是感觉非常繁琐,有没有简洁的算法。
    2016年1月13日 8:44
  • 你好,老邸

    获取一对一的很简单,而这个问题的一个关键点是如何找到一对多的关系,针对这个问题你可以参考如下这个类似的帖子。

    http://bbs.csdn.net/topics/391884847

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Albert Zhang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2016年1月14日 7:14