2 条题解

  • 1
    @ 2022-11-21 14:26:27
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n,x,y;
        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;
        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<<")"<<" ";	
    		    }
    	    }
        }
        cout<<endl;
    	return 0;
    }
    
    
    
    • 0
      @ 2024-12-11 19:42:31
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,x,y;
          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;
          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<<")"<<" ";	
      		    }
      	    }
          }
          cout<<endl;
      	return 0;
      }
      
      • 1

      信息

      ID
      1068
      时间
      1000ms
      内存
      128MiB
      难度
      5
      标签
      递交数
      163
      已通过
      65
      上传者