You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
997 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int N, i, j;
cin >> N >> i >> j;
//同一行
for (int k = 0; k < N; k++) {
cout << "(" << i << "," << k + 1 << ")";
}
cout << endl;
//同一列
for (int k = 0; k < N; k++) {
cout << "(" << k + 1 << "," << j << ")";
}
cout << endl;
//左上到右下对角线上的格子的位置,左右对角线的标准是x1-y1=x2-y2
for (int k = 0; k < N; ++k) {
for (int l = 0; l < N; ++l) {
if (l - k == j - i) {
cout << "(" << k + 1 << "," << l + 1 << ")";
}
}
}
cout << endl;
//左下到右上对角线上的格子的位置 x1+y1=x2+y2
for (int k = N - 1; k >= 0; k--) {
for (int l = 0; l < N; l++) {
if (l + k + 2 == i + j) {
cout << "(" << k + 1 << "," << l + 1 << ")";
}
}
}
cout << endl;
return 0;
}