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.

50 lines
714 B

#include<bits/stdc++.h>
using namespace std;
void show(int n,int i,int j) {
int a,b,c;
b=i;
c=j;
for(a=1; a<=n; a++) { //输出同一行上的位置
printf("(%d,%d)",i,a);
}
printf("\n");
for(a=1; a<=n; a++) { //输出同一列上的位置
printf("(%d,%d)",a,j);
}
printf("\n");
while(i>0&&j>0) { //左上到右下对角线上的格子的位置
i--;
j--;
}
i++;
j++;
while(i<=n&&j<=n) {
printf("(%d,%d)",i,j);
i++;
j++;
}
printf("\n");
i=b;
j=c;
while(i<=n&&j>0) { //左下到右上对角线上的格子的位置
i++;
j--;
}
i--;
j++;
while(i<=n&&j<=n&&i>0&&j>0) {
printf("(%d,%d)",i,j);
i--;
j++;
}
}
int main() {
int n,i,j;
scanf("%d %d %d",&n,&i,&j);
if(1<=i&&i<=n&&1<=j&&j<=n)
show(n,i,j);
return 0;
}