結果

問題 No.26 シャッフルゲーム
ユーザー AoiroFukurou
提出日時 2016-05-24 12:01:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 176 ms / 5,000 ms
コード長 511 bytes
コンパイル時間 3,300 ms
コンパイル使用メモリ 78,152 KB
実行使用メモリ 54,608 KB
最終ジャッジ日時 2024-10-07 03:53:31
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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;
		int tmp;
		tmp = cup[sf1];
		cup[sf1] = cup[sf2];
		cup[sf2] = tmp;
	}
	sc.close();
	for(int i = 0; i < 3; i++){
		if(cup[i] == 1){
			System.out.println(i + 1);
			break;
		}
	}
}
}
0