Pagini recente » Cod sursa (job #2389939) | Cod sursa (job #60698) | Cod sursa (job #395628) | Cod sursa (job #53564) | Cod sursa (job #133853)
Cod sursa(job #133853)
#include <cstdio>
const int maxn = 202;
FILE *in = fopen("oras.in","r"), *out = fopen("oras.out","w");
int n;
int a[maxn][maxn];
void go(int k)
{
if ( k <= 1 )
return;
go(k-2);
a[k-1][k] = 1;
for ( int i = 1; i <= k - 2; ++i )
a[i][k-1] = 1, a[k][i] = 1;
}
int main()
{
fscanf(in, "%d", &n);
if ( n == 4 )
{
fprintf(out, "%d\n", -1);
return 0;
}
if ( !(n % 2 ) )
for(;;);
go(n);
for ( int i = 1; i <= n; ++i )
{
for ( int j = 1; j <= n; ++j )
fprintf(out, "%d", a[i][j]);
fprintf(out, "\n");
}
return 0;
}