最大连续整数
public class Succession {static int num = 5, m = 5;static int k ;static boolean find;static int logo[] = new int[num];static int stamp[] = {0,1,4,12,21};//在剩余n中组合出面值和valuepublic static boolean comable(int n,int value){if(n>=0&&value ==0){find = true;int sum = 0;for(int i = 0;i<num&&logo[i]!=0;i++){sum+=stamp[logo[i]];System.out.print(stamp[logo[i]]+" , ");}System.out.println("总数为:"+ sum);}else{for(int i = 1;i<m&&!find&&n>0;i++){if(value - stamp[i]>=0){logo[k++] = i;comable(n-1,value-stamp[i]);logo[--k] = 0;}}}return find;}public static void main(String[] args){for(int i = 1;comable(num, i);i++,find = false);}}