結果

問題 No.26 シャッフルゲーム
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-05-24 11:27:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 170 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 3,924 ms
コンパイル使用メモリ 75,080 KB
実行使用メモリ 42,096 KB
最終ジャッジ日時 2024-04-16 10:36:18
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,628 KB
testcase_01 AC 127 ms
41,792 KB
testcase_02 AC 170 ms
41,956 KB
testcase_03 AC 142 ms
42,096 KB
testcase_04 AC 143 ms
42,036 KB
testcase_05 AC 163 ms
41,804 KB
testcase_06 AC 156 ms
41,696 KB
testcase_07 AC 151 ms
41,996 KB
testcase_08 AC 153 ms
41,668 KB
testcase_09 AC 165 ms
41,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No_026 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int[] cup = new int[4];

	cup[N] = 1;
	for(int i = 0; i < M; i++){
		int[] shuf = new int[2];
		shuf[0] = sc.nextInt();
		shuf[1] = sc.nextInt();
		if(cup[shuf[0]] == 1){
			cup[shuf[0]] = 0;
			cup[shuf[1]] =1;
		}else if(cup[shuf[1]] == 1){
			cup[shuf[1]] = 0;
			cup[shuf[0]] = 1;
		}
	}
	for(int i = 1; i < 4; i ++){
		if(cup[i] == 1){
			System.out.println(i);
			break;
		}
	}
}
}
0