• 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.

  • 相关阅读:
    comparator接口与Comparable接口的区别
    heap和stack有什么区别
    聚集索引和非聚集索引(整理)
    SQL里的EXISTS与in、not exists与not in
    SQL中CONVERT转化函数的用法
    GCC 对C语言的扩展
    C++宏定义详解
    How to Find Processlist Thread id in gdb !!!!!GDB 使用
    Netdata----Linux 性能实时监测工具
    java开发C语言编译器
  • 原文地址:https://www.cnblogs.com/fengju/p/6336223.html
Copyright © 2020-2023  润新知