And generating a combination Qiuzi problem set


import
java.util.Scanner; public class 求子集的组合问题 { static void print(int n) { for(int i=0;i<(1<<n);i++) { for(int j=0;j<n;j++) { if((i&(1<<j))!=0) { System.out.print(j+" "); } } System.out.println(); } } public static voidmain (String [] args) { // method TODO automatically generated stubs Scanner SC = new new Scanner (the System.in); int n-= sc.nextInt (); Print (n-); } }

Note: Any number of phase 0 and 0, with any number of phase and have to have any number

Guess you like

Origin www.cnblogs.com/ybc7/p/11480177.html