1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> int main() { int m; scanf("%d", &m); int a, b; int arr[4] = { 0,1,0,0 }; for (int i = 0; i < m; i++) { scanf("%d %d", &a, &b); int tmp = arr[a]; arr[a] = arr[b]; arr[b] = tmp; } for (int i = 1; i <= 3; i++) { if (arr[i] == 1) printf("%d", i); } } | cs |
'알고리즘 > 시뮬레이션' 카테고리의 다른 글
1592 영식이와 친구들 (0) | 2020.01.15 |
---|---|
2979 트럭 주차 (0) | 2020.01.15 |
2164 카드2 (0) | 2020.01.15 |
2161 카드1 (0) | 2020.01.15 |
2455 지능형 기차 (0) | 2020.01.14 |