結果

問題 No.26 シャッフルゲーム
ユーザー AoiroFukurouAoiroFukurou
提出日時 2016-05-24 11:55:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 561 bytes
コンパイル時間 3,236 ms
コンパイル使用メモリ 76,712 KB
実行使用メモリ 41,988 KB
最終ジャッジ日時 2024-04-16 10:38:45
合計ジャッジ時間 5,401 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,516 KB
testcase_01 AC 119 ms
40,252 KB
testcase_02 AC 161 ms
41,700 KB
testcase_03 AC 143 ms
41,888 KB
testcase_04 AC 144 ms
41,508 KB
testcase_05 AC 160 ms
41,916 KB
testcase_06 AC 150 ms
41,820 KB
testcase_07 AC 144 ms
41,336 KB
testcase_08 AC 159 ms
41,988 KB
testcase_09 AC 155 ms
41,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class No_26v2 {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int[] cup = new int[3];
	int N = sc.nextInt();
	int M = sc.nextInt();
	cup[N - 1] = 1;
	for(int i = 0; i < M; i++){
		int sf1 = sc.nextInt() - 1;
		int sf2 = sc.nextInt() - 1;
		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 + 1);
			break;
		}
	}
}
}
0