49,918
社区成员




public class Com {
static char[] characters = {'a','b','c','d','e','f','g','h','i',
'j','k','l','m','n','o','p','q','r',
's','t','u','v','w','x','y','z'};
static int num = 5;
static int count = 0;
//脚标数组
static int[] a = new int[num];
public static void increaseByOne(){
a[num-1]++;
count++;
for (int i = a.length - 1 ; i > 0 ; i--) {
if(a[i]>26)
{
a[i-1]++;
a[i] = 0;
}
}
setArray();
}
public static void setArray(){
for (int i = 1; i < a.length; i++) {
for (int j =0 ; j < i; j++) {
if (a[j] > a[i]) {
a[i] = a[j];
}
}
}
}
public static void printA()
{
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]+",");
}
System.out.println();
}
public static void main(String[] args) {
printA();
while(a[0] <= 26)
{
increaseByOne();
printA();
}
System.out.println("一共"+(count+1)+"组合");
}
}