Design a site like this with
Get started


package practice;

import java.util.Scanner;

public class SinhNhiPhan {
static int n;
static int []arr;
static void result() {
for(int i=0; i<n; i++) {
System.out.print(arr[i]+” “);
static void Try(int index) {
for(int j=0; j<=1; j++) {
arr[index] = j;
if(index == n-1) result(); // đến cấu hình cuối cùng thì in ra tất cả, vì từ 0 tới n
// còn index == n thì lại sinh từ đâu
else Try(index+1);
public static void main(String[] args) {
Scanner sc = new Scanner(;
n = sc.nextInt();
arr = new int[n+1];



Author: alexishuuuocn

I'm a software engineer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: