結果

問題 No.26 シャッフルゲーム
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-05-24 11:46:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 3,332 ms
コンパイル使用メモリ 78,368 KB
実行使用メモリ 42,248 KB
最終ジャッジ日時 2024-04-16 10:37:04
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No_26v2 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int M = sc.nextInt();
	int[] cup = new int[3];
	cup[N - 1] = 1;
	for(int i = 0; i < M; i++){
		int sf1 = sc.nextInt() - 1;
		int sf2 = sc.nextInt() - 1;
		if(cup[sf1] == 0 && cup[sf2] == 0){
			continue;
		}else if(cup[sf1] == 1){
			cup[sf1] = 0;
			cup[sf2] = 1;
		}else if(cup[sf2] == 1){
			cup[sf1] = 1;
			cup[sf2] = 0;
		}
	}
	sc.close();
	for(int i = 0; i < 3; i++){
		if(cup[i] == 1){
			System.out.println(i);
			break;
		}
	}
}
}
0