Codtest
Codtest
#include <iostream>
ifstream f("in.txt");
ofstream g("out.txt");
int main()
{
int n;
f >> n;
for (int i = 0; i < n; i++) {
int x, y, z;
int a[501][501] = { 0 };
f >> x >> y >> z;
int k;
int id = 1;
#include <fstream>
#include <iostream>
ifstream f("in.txt");
ofstream g("out.txt");
int main() {
int a[101][101] = { 0 };
int n, m, z;
f >> n >> m >> z;
int top = 1, bottom = n, left = 1, right = m;
a[k][i] = 1;
a[k+1][i] = 1;
if (i == right - 3) {
a[top][right] = 1;
a[top][right - 1] = 1;
top += 2;
ok = true;
break;
}
i+=2;
}
if (ok != true) {
top += 3;
}
k = right;
i = top;
ok = false;
while (i <= bottom) {
a[i][k] = 1;
a[i][k-1] = 1;
if (i == bottom - 3) {
a[right][bottom] = 1;
a[right][bottom-1] = 1;
right -= 2;
ok = true;
break;
}
i += 2;
}
if (ok != true) {
right -= 3;
}
k = bottom;
i = right;
ok = false;
while (i >= left ) {
a[k][i] = 1;
a[k-1][i] = 1;
if (i == left + 3) {
a[left][bottom] = 1;
a[left][bottom+1] = 1;
bottom -= 2;
ok = true;
break;
}
i += 2;
}
if (ok != true) {
bottom -= 3;
}
k = left;
i = bottom;
ok = false;
while (i >= top) {
a[i][k] = 1;
a[i][k+1] = 1;
if (i == top + 3) {
a[top][left] = 1;
a[top][left + 1] = 1;
left += 2;
ok = true;
break;
}
i += 2;
}
if (ok != true) {
left += 3;
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
g << a[i][j] << " ";
}
g << "\n";
}
return 0;
}