2 solutions

  • 0
    @ 2024-11-29 19:54:10

    #include<bits/stdc++.h> using namespace std; int main() { int n,i,j,t,m; cin>>n>>i>>j; for(t=1;t<=n;t++){ cout<<"("<<i<<","<<t<<") "; } cout<<endl; for(t=1;t<=n;t++){ cout<<"("<<t<<","<<j<<") "; } cout<<endl; int a=i,b=j; while(a>=2&&b>=2){ a--; b--; } while(a<=n&&b<=n){ cout<<"("<<a<<","<<b<<") "; a++; b++; } cout<<endl; a=i,b=j; while(a<n&&b>1){ a++; b--; } while(a>=1&&b<=n){ cout<<"("<<a<<","<<b<<") "; a--; b++; } return 0; }

    • 0
      @ 2024-10-6 0:50:20

      #include<stdio.h> int main(){ int i,j,n,m,N; int cnt=0; scanf("%d %d %d",&N,&i,&j); for(n=1;n<=N;n++){ printf("(%d,%d) ",i,n); cnt++; if(cntN)printf("\n"); } cnt=0; for(m=1;m<=N;m++){ printf("(%d,%d) ",m,j); cnt++; if(cntN)printf("\n"); } cnt=0; if(i<=j){ m=1; n=j-i+1; while(n<=N){ printf("(%d,%d) ",m,n); m++; n++; } printf("\n"); } else { n=1; m=i-j+1; while(m<=N){ printf("(%d,%d) ",m,n); m++; n++; } printf("\n");
      } if(N-i>=j-1){ n=1; m=i+j-1; while (m>=1){ printf("(%d,%d) ",m,n); m--; n++;} printf("\n"); } else { m=N; n=j-N+i; while(n<=N){ printf("(%d,%d) ",m,n); m--; n++; } printf("\n"); } return 0; }

      • 1

      Information

      ID
      6778
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      7
      Tags
      (None)
      # Submissions
      109
      Accepted
      24
      Uploaded By