結果

問題 No.26 シャッフルゲーム
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-14 23:59:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 71,432 KB
実行使用メモリ 40,448 KB
最終ジャッジ日時 2023-10-11 12:50:15
合計ジャッジ時間 4,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
40,060 KB
testcase_01 AC 122 ms
39,508 KB
testcase_02 AC 143 ms
40,104 KB
testcase_03 AC 131 ms
39,580 KB
testcase_04 AC 137 ms
40,120 KB
testcase_05 AC 142 ms
39,860 KB
testcase_06 AC 143 ms
39,936 KB
testcase_07 AC 135 ms
39,448 KB
testcase_08 AC 144 ms
40,448 KB
testcase_09 AC 157 ms
40,296 KB
権限があれば一括ダウンロードができます

ソースコード

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