解题思路:
注意事项:
参考代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1000;
ll a[N][N];
int main()
{
ll n,x,y;
cin>>n>>x>>y;
for(int j=1; j<=n; j++)//同一行的元素
{
cout<< '('<<x<<','<<j<<')'<<' ';
}
cout<<endl;
for(int i=1; i<=n; i++)//同一列的元素
{
cout<< '('<<i<<','<<y<<')'<<' ';
}
cout<<endl;
for(int i=1; i<=n; i++)//同一主对角线方向的元素
{
for(int j=1; j<=n; j++)
{
if(i-j==x-y)
{
cout<< '('<<i<<','<<j<<')'<<' ';
}
}
}
cout<<endl;
for(int j=1;j<=n; j++)//同一副对角线方向的元素
{
for(int i=1; i<=n; i++)
{
if(i+j==x+y)
{
cout<< '('<<i<<','<<j<<')'<<' ';
}
}
}
cout<<endl;
return 0;
}
0.0分
0 人评分