結果

問題 No.26 シャッフルゲーム
ユーザー k_kadora
提出日時 2015-05-19 03:22:06
言語 Java
(openjdk 23)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 3,889 ms
コンパイル使用メモリ 74,084 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-07-06 05:41:47
合計ジャッジ時間 4,865 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Shaffle{
	public static void main(String[] arg){
		int n,m,a,b,temp,res=0;
		int[] cap={0,0,0};
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		cap[n-1]=1;
		for(int i = 0;i<m;i++){
			a = sc.nextInt();
			b = sc.nextInt();
			temp = cap[a-1];
			cap[a-1] = cap[b-1];
			cap[b-1] = temp;
		}
		for(int i = 0;i<3;i++){
			if(cap[i]==1)res=i+1;
		}
		System.out.println(res);
	}
}
0