#include
<
stdio.h
>
#include < sstream >
#include < map >
#include < iostream >
#include < math.h >
using namespace std;
char * P ;
void GetNearest( int N)
{
P = new char [N + 1 ];
for ( int i = 0 ;i < N;i ++ )
{
P[i] = ' 0 ' ;
}
P[N] = 0 ;
cout << P << endl;
for ( int i = 0 ;i < N;i ++ )
{
P[N - i - 1 ] = ' 1 ' ;
cout << P << endl;
for ( int j = 0 ;j < ( int )pow( 2.0 ,i) - 1 ;j ++ )
{
P[N - j % i - 1 ] = P[N - j % i - 1 ] == ' 0 ' ? ' 1 ' : ' 0 ' ;
cout << P << endl;
}
}
}
void main()
{
GetNearest( 4 );
}
#include < sstream >
#include < map >
#include < iostream >
#include < math.h >
using namespace std;
char * P ;
void GetNearest( int N)
{
P = new char [N + 1 ];
for ( int i = 0 ;i < N;i ++ )
{
P[i] = ' 0 ' ;
}
P[N] = 0 ;
cout << P << endl;
for ( int i = 0 ;i < N;i ++ )
{
P[N - i - 1 ] = ' 1 ' ;
cout << P << endl;
for ( int j = 0 ;j < ( int )pow( 2.0 ,i) - 1 ;j ++ )
{
P[N - j % i - 1 ] = P[N - j % i - 1 ] == ' 0 ' ? ' 1 ' : ' 0 ' ;
cout << P << endl;
}
}
}
void main()
{
GetNearest( 4 );
}