1 solutions

  • 0
    @ 2025-11-5 18:31:39

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int a[11][11];
    int main()
    {
    	int 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 i=n;i>=1;i--)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			if(i+j==x+y)
    			{
    				cout<<'('<<i<<','<<j<<") "; 
    			}
    		}
    	}
    	return 0;
    }
    
    
    • 1

    Information

    ID
    18906
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By