4 solutions

  • 0
    @ 2024-4-9 20:44:06

    ``

    #include <iostream>
    #include <stdio.h>
    int main() {
        int a[6][6]={0};
        int b[6];
        int x,y;
        for (int i = 1; i < 6; i++) {
            for (int j = 1; j < 6; j++) {
                scanf("%d", &a[i][j]);
            }
        }
        scanf("%d",&x);
        scanf("%d",&y);
        printf("\n");
    
        for(int i=1;i<6;i++){
            b[i]=a[x][i];
        }
            for (int j = 1; j <6 ; ++j) {
                a[x][j]=a[y][j];
            }
        for (int j = 1; j <6 ; ++j) {
            a[y][j]=b[j];
        }
            for (int i = 1; i < 6; i++) {
                for (int j = 1; j < 6; ++j) {
                    printf("%d ", a[i][j]);
                }
                printf("\n");
            }
            return 0;
    
    }
    

    Information

    ID
    86
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    4
    Tags
    # Submissions
    259
    Accepted
    119
    Uploaded By