結果

問題 No.26 シャッフルゲーム
ユーザー 37zigen
提出日時 2016-04-01 16:12:55
言語 Java
(openjdk 23)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 73,704 KB
実行使用メモリ 54,264 KB
最終ジャッジ日時 2024-10-02 08:48:27
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder026;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[] a=new int[3];
		a[sc.nextInt()-1]=1;
		int m=sc.nextInt();
		for(int i=0;i<m;i++){
			int b=sc.nextInt()-1;
			int c=sc.nextInt()-1;
			int d=a[b];
			a[b]=a[c];
			a[c]=d;
		}
		for(int i=0;i<3;i++){
			if(a[i]==1){
				System.out.println(i+1);
			}
		}
	}
}
0