結果

問題 No.26 シャッフルゲーム
ユーザー suiginginsuigingin
提出日時 2015-07-07 22:17:33
言語 Java19
(openjdk 21)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 527 bytes
コンパイル時間 4,217 ms
コンパイル使用メモリ 72,328 KB
実行使用メモリ 58,356 KB
最終ジャッジ日時 2023-09-22 09:22:39
合計ジャッジ時間 5,181 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,700 KB
testcase_01 AC 119 ms
55,784 KB
testcase_02 AC 144 ms
57,812 KB
testcase_03 AC 129 ms
56,464 KB
testcase_04 AC 136 ms
56,628 KB
testcase_05 AC 139 ms
56,572 KB
testcase_06 AC 140 ms
56,696 KB
testcase_07 AC 136 ms
55,988 KB
testcase_08 AC 142 ms
58,356 KB
testcase_09 AC 151 ms
56,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
	}
}
0