結果

問題 No.26 シャッフルゲーム
ユーザー 37zigen37zigen
提出日時 2016-04-01 16:12:55
言語 Java19
(openjdk 21)
結果
AC  
実行時間 162 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 2,469 ms
コンパイル使用メモリ 71,968 KB
実行使用メモリ 55,892 KB
最終ジャッジ日時 2023-07-25 15:00:17
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,708 KB
testcase_01 AC 130 ms
55,568 KB
testcase_02 AC 158 ms
55,832 KB
testcase_03 AC 143 ms
55,884 KB
testcase_04 AC 145 ms
55,608 KB
testcase_05 AC 154 ms
55,836 KB
testcase_06 AC 160 ms
55,836 KB
testcase_07 AC 143 ms
55,892 KB
testcase_08 AC 157 ms
53,960 KB
testcase_09 AC 162 ms
55,740 KB
権限があれば一括ダウンロードができます

ソースコード

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