前6位1到33的数字(不重复),最大33,第七位最大11


public class num {
	static int k = 0;

	public static void main(String[] args) {
		// 第n
		int a[] = new int[33];
		for (int b = 0; b < 33; b++) {
			a[b] = b + 1;
		}
		permutations(a, 0, 5);
	}

	public static void permutations(int[] a, int m, int n) {
		if (m == n) {
			k++;
			System.out.println("第" + k + "组:");
			for (int j = 1; j <= 11; j++) {
				System.out.println("前6位数");
				for (int i = 0; i <= n; i++) {
					System.out.print( a[i]+"  " );
				}
				System.out.print("第7位数:"+j+"n");
			}
			
			System.out.println();
		} else {
			for (int i = 0; i < 33; i++) {
				int temp = a[m];
				a[m] = a[i];
				a[i] = temp;
				permutations(a, m + 1, n);
				temp = a[m];
				a[m] = a[i];
				a[i] = temp;
			}

		}
	}
}



知识共享许可协议本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可。

相关推荐

暂无评论