Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- PL/SQL
- 자료구조
- DP
- db
- 클라우드
- 알고리즘
- 데이터베이스
- MST
- retry
- 쿼리
- Intellj
- 디자인 패턴
- golang
- 오라클
- 코딩
- Spring Cloud
- Spring Boot
- 페이징
- feign
- SQL
- Spring Cloud Feign
- aws
- Spring
- Jenkins
- JPA
- 운영체제
- 백준
- Kafka
- MVC
- 자바
Archives
- Today
- Total
justgo_developer
[JAVA] 백준 1547 공 본문
import java.util.*;
public class Main {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int M = sc.nextInt();
int[] cup = new int[4];
cup[1]=1;
for(int i=0;i<M;i++){
int x = sc.nextInt();
int y = sc.nextInt();
int temp = cup[x];
cup[x] = cup[y];
cup[y] = temp;
}
for(int i=1;i<=3;i++){
if(cup[i]==1)
System.out.print(i);
}
}
}
'IT > 코딩 문제 풀이' 카테고리의 다른 글
[JAVA] 백준 1012 유기농배추 (0) | 2018.01.10 |
---|---|
[JAVA]백준 2178 미로탐색 (0) | 2018.01.09 |
[JAVA] 백준 2161 카드1 (0) | 2018.01.03 |
[JAVA] 백준 1057 토너먼트 (0) | 2018.01.01 |
[JAVA] 백준 2455번 지능형기차 (0) | 2018.01.01 |