結果

問題 No.26 シャッフルゲーム
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 01:47:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 1,823 ms
コンパイル使用メモリ 74,876 KB
実行使用メモリ 54,424 KB
最終ジャッジ日時 2024-04-09 20:52:19
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
54,048 KB
testcase_01 AC 104 ms
54,088 KB
testcase_02 AC 131 ms
54,424 KB
testcase_03 AC 118 ms
54,288 KB
testcase_04 AC 120 ms
54,112 KB
testcase_05 AC 126 ms
54,224 KB
testcase_06 AC 124 ms
53,692 KB
testcase_07 AC 118 ms
53,716 KB
testcase_08 AC 137 ms
54,260 KB
testcase_09 AC 141 ms
54,280 KB
権限があれば一括ダウンロードができます

ソースコード

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