2 solutions

  • 1
    @ 2024-4-1 11:26:09

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

    • 1
      @ 2024-4-1 11:25:31

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

      • 1

      Information

      ID
      6915
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      1
      Tags
      # Submissions
      50
      Accepted
      40
      Uploaded By