Pagini recente » Cod sursa (job #1076221) | Cod sursa (job #1691971) | Cod sursa (job #2356168) | Cod sursa (job #2673620) | Cod sursa (job #2631065)
#include<fstream>
using namespace std;
ifstream in ("oras.in");
ofstream out ("oras.out");
int mat[201][201],n,k;
int main (void) {
in >> n;
for (int i = 1; i < n; i ++) {
mat[i+1][i] = 1;
}
mat[1][n] = 1;
for (int i = 1; i <= n; i ++) {
for (int j = i + 2, p = 0; j <= n; j ++, p++) {
if (i == 1 && j == n) continue;
if (p % 2 == 0) {
mat[i][j] = 1;
}
else {
mat[j][i] = 1;
}
}
}
for (int i = 1; i <= n; i ++) {
for (int j = 1; j <= n; j ++) {
out << mat[i][j] << " ";
}
out <<"\n";
}
return 0;
}