對於長度為5位的一個01串,每一位都可能是0或1,一共有32種可能。它們的前幾個是:
00000
00001
00010
00011
00100
請按從小到大的順序輸出這32種01串。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int a=0;a<2;a++){
for(int b=0;b<2;b++){
for(int c=0;c<2;c++){
for(int d=0;d<2;d++){
for(int e=0;e<2;e++){
System.out.println(""+a+b+c+d+e);
}
}
}
}
}
}
}