結果
| 問題 | No.26 シャッフルゲーム | 
| コンテスト | |
| ユーザー |  suigingin | 
| 提出日時 | 2015-07-07 22:17:33 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 168 ms / 5,000 ms | 
| コード長 | 527 bytes | 
| コンパイル時間 | 4,194 ms | 
| コンパイル使用メモリ | 74,436 KB | 
| 実行使用メモリ | 54,212 KB | 
| 最終ジャッジ日時 | 2024-07-08 01:32:04 | 
| 合計ジャッジ時間 | 6,188 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
package no_000;
import java.util.Scanner;
public class No_026 {
	Scanner sc = new Scanner(System.in);
	void run() {
		int N = sc.nextInt() - 1;
		int M = sc.nextInt();
		int[] cup = new int[3];
		cup[N] = 1;
		while (M-- > 0) {
			swap(cup, sc.nextInt() - 1, sc.nextInt() - 1);
		}
		for (int i = 0; i < 3; i++) {
			if (cup[i] == 1) System.out.println(i + 1);
		}
	}
	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}
	public static void main(String[] args) {
		new No_026().run();
	}
}
            
            
            
        