結果

問題 No.26 シャッフルゲーム
ユーザー mits58
提出日時 2016-07-02 11:35:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 177 ms / 5,000 ms
コード長 483 bytes
コンパイル時間 2,198 ms
コンパイル使用メモリ 73,892 KB
実行使用メモリ 41,660 KB
最終ジャッジ日時 2024-10-12 02:23:10
合計ジャッジ時間 4,324 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			boolean[] c=new boolean[3];
			Arrays.fill(c,false);
			c[sc.nextInt()-1]=true;
			int m=sc.nextInt();
			for(int i=0;i<m;i++){
				int p=sc.nextInt();
				int q=sc.nextInt();
				boolean temp=c[p-1];
				c[p-1]=c[q-1];
				c[q-1]=temp;
			}
			for(int i=0;i<3;i++) if(c[i]) System.out.println(i+1);
		}
	}
}
0