結果

問題 No.26 シャッフルゲーム
ユーザー YatsukuYatsuku
提出日時 2015-12-15 21:33:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 1,801 ms
コンパイル使用メモリ 71,428 KB
実行使用メモリ 56,340 KB
最終ジャッジ日時 2023-10-13 17:12:40
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
55,848 KB
testcase_01 AC 107 ms
56,040 KB
testcase_02 AC 137 ms
55,900 KB
testcase_03 AC 122 ms
55,392 KB
testcase_04 AC 120 ms
55,932 KB
testcase_05 AC 144 ms
55,900 KB
testcase_06 AC 136 ms
56,052 KB
testcase_07 AC 119 ms
55,696 KB
testcase_08 AC 127 ms
56,144 KB
testcase_09 AC 158 ms
56,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


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

		int []cup = new int [3];

		int num = stdIn.nextInt();
		int shuffle = stdIn.nextInt();

		for (int i = 0; i < 3; i++) {
			cup[i] = 0;
		}
		cup[num-1] = 1;

		for (int i = 0; i < shuffle; i++) {
			int swap1 = stdIn.nextInt();
			int swap2 = stdIn.nextInt();

			int tmp = cup[swap1-1];
			cup[swap1-1] = cup[swap2-1];
			cup[swap2-1] = tmp;
		}
		for (int i = 0; i < 3; i++) {
			if ( cup[i] == 1 ) {
				System.out.println(i+1);
				break;
			}	
		}
	}
}
0