結果

問題 No.26 シャッフルゲーム
ユーザー TatsuDXTatsuDX
提出日時 2016-09-08 23:32:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 455 bytes
コンパイル時間 3,201 ms
コンパイル使用メモリ 72,508 KB
実行使用メモリ 56,400 KB
最終ジャッジ日時 2023-08-10 00:00:09
合計ジャッジ時間 5,180 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
55,500 KB
testcase_01 AC 99 ms
56,192 KB
testcase_02 AC 128 ms
55,608 KB
testcase_03 AC 110 ms
56,400 KB
testcase_04 AC 115 ms
56,296 KB
testcase_05 AC 117 ms
55,748 KB
testcase_06 AC 122 ms
56,096 KB
testcase_07 AC 117 ms
55,876 KB
testcase_08 AC 119 ms
55,424 KB
testcase_09 AC 127 ms
56,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int[] t = new int[3];
		t[sc.nextInt() - 1] = 1;
		int n = sc.nextInt(), a, b, tmp;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt() - 1;
			b = sc.nextInt() - 1;
			tmp = t[a];
			t[a] = t[b];
			t[b] = tmp;
		}
		for (int i = 0; i < 3; i++) {
			if (t[i] == 1) {
				System.out.println(i + 1);
				return;
			}
		}
	}
}
0