Pagini recente » Cod sursa (job #2180076) | Cod sursa (job #1711085) | Infoarena Monthly 2014 - Clasament | Cod sursa (job #2488692) | Cod sursa (job #2631064)
#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 (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;
}