Quick actions

cmd+k|ctrl+k

Navigation

Languages

백준 10813 - C

Snippet info

Language

C

Visibility

public

Author

legacy-v1-13979

Created

2023-10-16T06:41:06.01335Z

Updated

2023-10-16T06:41:06.01335Z

#include <stdio.h>

int main(void) {
    int N, M;
    int i, j, temp;
    
    int basket[100];
    
    scanf("%d %d", &N, &M);
    
    for (int x = 0; x < N; x++) {
        basket[x] = x + 1;
    }
    
    for (int x = 0; x < M; x++) {
        scanf("%d %d", &i, &j);
        
        temp = basket[i-1];
        basket[i-1] = basket[j-1];
        basket[j-1] = temp;
        
    }
    
    for (int x = 0; x < N; x++) {
        printf("%d ", basket[x]);
    }

    return 0;
}
INFO