結果

問題 No.26 シャッフルゲーム
ユーザー 37zigen37zigen
提出日時 2016-04-01 16:12:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 175 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 74,312 KB
実行使用メモリ 54,700 KB
最終ジャッジ日時 2024-04-10 07:06:03
合計ジャッジ時間 4,368 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,008 KB
testcase_01 AC 130 ms
54,160 KB
testcase_02 AC 168 ms
54,268 KB
testcase_03 AC 142 ms
54,252 KB
testcase_04 AC 147 ms
54,248 KB
testcase_05 AC 154 ms
54,380 KB
testcase_06 AC 158 ms
54,464 KB
testcase_07 AC 148 ms
54,240 KB
testcase_08 AC 159 ms
54,032 KB
testcase_09 AC 175 ms
54,700 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