数组{a,b,c,d,...}   ;  ...为省略号,数组大小会变化,但运算前能确定。寻一个算法,得出结果列表(可能还需将运算公式保留下来)。
a,
a+b,
a+c,
a+d,
a+...,
a+b+c,
a+b+d,
a+b+...,
....
b,
b+c,
b+d,
b+...,
b+c+d,
b+c+...,
.....
c,
c+d,
c+...
c+d+...
....d,
d+....
本人愚钝,或者钻死角里头去了,没能想出解决方法,请大家费心了!
   

解决方案 »

  1.   

    自己看看对吗?代码:
    public class Shu{
       public static void main(String args[]){
        char A[]={'a','b','c','d','e','f','g','h','i','g','k','l'};  for(int i=0;i<A.length;i++){
        System.out.println(A[i]);
              for(int j=1;j<A.length;j++){
                  System.out.println(A[i]+"+"+A[j]); 
                    
              }
                 for(int k=2;k<A.length;k++){
                  System.out.println(A[i]+"+"+A[i+1]+"+"+A[k]); 
                 } }
    }
    }
      

  2.   

    先看看有没有他法,因为A.length有可能达到20,甚至更多。
      

  3.   

    http://topic.csdn.net/u/20100819/10/18467d60-71dc-4030-8c51-5fde1074e8b0.html参考一下吧.问题类似.要上班拉.没时间拉.
      

  4.   

    找到答案了!
    http://topic.csdn.net/u/20090217/21/f41ed9f6-f929-451c-a5c9-80d2e408422a.html?seed=784894353好精妙!
    也谢谢上面各位了!