Pagini recente » Cod sursa (job #33724) | Cod sursa (job #2786046) | Cod sursa (job #41554) | Cod sursa (job #2951849) | Cod sursa (job #2039629)
#include <bits/stdc++.h>
const int MAXN = 200;
bool ok[MAXN + 1][MAXN + 1];
int main() {
FILE *fi, *fout;
int i, j, n;
fi = fopen("oras.in" ,"r");
fout = fopen("oras.out" ,"w");
fscanf(fi,"%d " ,&n);
if(n == 1)
fprintf(fout,"1");
else if(n == 2 || n == 4)
fprintf(fout,"-1");
else {
for(i = 1; i < n; i++) {
for(j = 1; j <= n; j++) {
int a = j;
int b = i + j;
if(b > n)
b -= n;
if(ok[b][a] == 0)
ok[a][b] = 1;
}
}
for(i = 1; i <= n; i++) {
for(j = 1; j <= n; j++)
fprintf(fout,"%d " ,ok[i][j]);
fprintf(fout,"\n");
}
}
fclose(fi);
fclose(fout);
return 0;
}