1 solutions
-
0
#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
- 106
- Accepted
- 23
- Uploaded By