import java.io.*;
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException {
TextIO.readStream(System.in);
int dataset=TextIO.getlnInt();
for(int i=0;i<dataset;i++){
if(i!=0)
System.out.println();
int N=TextIO.getInt();
int H=TextIO.getInt();
String temp="";
for(int j=0;j<(1<<N);j++){
boolean stat=Integer.bitCount(j)==H;
if(stat)
temp=Integer.toBinaryString(j);
for(int z=temp.length();z<N;z++)
temp="0"+temp;
if(stat)
System.out.println(temp);
}
}
}
}
import java.util.IllegalFormatException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class Main{
public static void main(String[] args) throws FileNotFoundException {
TextIO.readStream(System.in);
int dataset=TextIO.getlnInt();
for(int i=0;i<dataset;i++){
if(i!=0)
System.out.println();
int N=TextIO.getInt();
int H=TextIO.getInt();
String temp="";
for(int j=0;j<(1<<N);j++){
boolean stat=Integer.bitCount(j)==H;
if(stat)
temp=Integer.toBinaryString(j);
for(int z=temp.length();z<N;z++)
temp="0"+temp;
if(stat)
System.out.println(temp);
}
}
}
}
No comments:
Post a Comment