90分,求助
查看原帖
90分,求助
1340703
xianghaoyu666楼主2024/5/15 21:12
#include<bits/stdc++.h>
using namespace std;
int h[11][11],l[11][11],zd[11][11],yd[11][11];
bool a[11][11];
int n,ii,jj;
int main(){
    cin>>n>>ii>>jj;
    for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			a[i][j]=1;
		}	
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(i==ii){
			    h[i][j]=a[i][j];
			}
			if(j==jj){
			    l[i][j]=a[i][j];
			}
			if(((10*i+j)-(10*ii+jj))%11==0 || ((10*ii+jj)-(10*i+j))%11==0){
			    zd[i][j]=a[i][j];
			}
			if(i+j==ii+jj){
			    yd[i][j]=a[i][j];
			}
		}	
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(h[i][j]){
			    cout<<'('<<i<<','<<j<<')'<<' ';
			}
		}	
	}
	cout<<endl;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(l[i][j]){
			    cout<<'('<<i<<','<<j<<')'<<' ';
			}
		}	
	}
	cout<<endl;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(zd[i][j]){
			    cout<<'('<<i<<','<<j<<')'<<' ';
			}
		}	
	}
	cout<<endl;
	for(int i=n;i>=1;i--){
		for(int j=n;j>=1;j--){
			if(yd[i][j]){
			    cout<<'('<<i<<','<<j<<')'<<' ';
			}
		}	
	}
	cout<<endl;
	return 0;
}
2024/5/15 21:12
加载中...