結果

問題 No.26 シャッフルゲーム
ユーザー YukimotoPG
提出日時 2019-02-14 23:59:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 175 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 2,177 ms
コンパイル使用メモリ 74,148 KB
実行使用メモリ 41,848 KB
最終ジャッジ日時 2024-09-13 11:37:52
合計ジャッジ時間 4,336 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		boolean[] cup = new boolean[3];
		cup[sc.nextInt()-1] = true;
		
		int n = sc.nextInt();
		for (int i=0; i<n; i++) {
			int a = sc.nextInt()-1; int b = sc.nextInt()-1;
			boolean t = cup[a];
			cup[a] = cup[b];
			cup[b] = t;
		}
		
		for (int i=0; i<3; i++) {
			if (cup[i] == true) System.out.println(i+1);
		}
		
	}
}
0