zoukankan      html  css  js  c++  java
  • Multi select elements which sums upto a certain number from an array(II)

    Give an array and a certain number,how to select some of the elements to sums upto the number? (Also see http://blog.csdn.net/northwolves/archive/2008/11/25/3372338.aspx)
    The following codes can bring you solutions out in Column A of Excel worksheet :

    It returns:

    1+10+11+12+12+13+14+15=88
    1+10+11+15+16+17+18=88
    1+10+12+14+16+17+18=88
    1+10+12+14+16+17+18=88
    1+10+13+14+15+17+18=88
    1+11+12+13+16+17+18=88
    1+11+12+13+16+17+18=88
    1+11+12+14+15+17+18=88
    1+11+12+14+15+17+18=88
    1+11+13+14+15+16+18=88

    ......

    Total 8528 solutions within about 3 seconds.

  • 相关阅读:
    TongJI Online Judge预赛(3): Game
    堆栈小应用:配对
    在.net中使用Udp协议创建简单的聊天程序
    TongJI Online Judge预赛(2): LOVE LETTER
    全排列问题之递归求解
    如何打造RSS阅读器
    Html 常用标志总结
    实现页面的分帧显示
    每天OnlineJudge之 “数素数”
    文本编辑器中,如何设计 撤销/重复栈
  • 原文地址:https://www.cnblogs.com/fengju/p/6336223.html
Copyright © 2011-2022 走看看