2 solutions

  • 1
    @ 2026-10-24 15:37:10
    #include <bits/stdc++.h>
    using namespace std;
    
    int main()
    {
    	int n,a,b;
    	cin>>n>>a>>b;
    	for(int j=1;j<=n;j++)
    	{
    		cout<<"("<<a<<","<<j<<") ";
    	}
    	cout<<endl;
    	for(int i=1;i<=n;i++)
    	{
    		cout<<"("<<i<<","<<b<<") ";
    	}
    	cout<<endl;
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			if(i-j==a-b)
    			{
    				cout<<"("<<i<<","<<j<<") ";
    			}
    		}
    	}
    	cout<<endl;
    	for(int i=n;i>=1;i--)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			if(i+j==a+b)
    			{
    				cout<<"("<<i<<","<<j<<") ";
    			}
    		}
    	}
    	return 0;
    }
    • 0
      @ 2026-10-11 15:27:36

      #include <bits/stdc++.h> using namespace std; int n,x,y; int main(){ cin>>n>>x>>y; for(int i = 1;i<=n;i++){ cout<<"("<<x<<","<<i<<") "; }cout<<endl; for(int i = 1;i<=n;i++){ cout<<"("<<i<<","<<y<<") "; }cout<<endl; int zsx=x,zsy=y,ysx=x,ysy=y; while(zsx>1&&zsy>1){ zsx--; zsy--; } while(ysx<n&&ysy<n){ ysx++; ysy++; } while(zsx<=ysx&&zsy<=ysy){ cout<<"("<<zsx<<","<<zsy<<") "; zsx++; zsy++; }cout<<endl; int zxx=x,zxy=y,ysx1=x,ysy1=y; while(zxx<n&&zxy>1){ zxx++; zxy--; } while(ysx1>1&&ysy1<n){ ysx1--; ysy1++; } while(zxx>=ysx1&&zxy<=ysy1){ cout<<"("<<zxx<<","<<zxy<<") "; zxx--; zxy++; }cout<<endl; return 0; }

      • 1

      Information

      ID
      902
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      304
      Accepted
      66
      Uploaded By