結果

問題 No.26 シャッフルゲーム
ユーザー Tsukasa_Type
提出日時 2018-02-09 01:47:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 2,781 ms
コンパイル使用メモリ 74,668 KB
実行使用メモリ 41,972 KB
最終ジャッジ日時 2024-10-01 21:16:36
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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