結果

問題 No.26 シャッフルゲーム
ユーザー カニ戯(ryカニ戯(ry
提出日時 2015-02-26 16:17:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 185 ms / 5,000 ms
コード長 314 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 72,308 KB
実行使用メモリ 56,296 KB
最終ジャッジ日時 2023-09-06 05:05:28
合計ジャッジ時間 4,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,628 KB
testcase_01 AC 126 ms
55,572 KB
testcase_02 AC 184 ms
55,788 KB
testcase_03 AC 140 ms
55,588 KB
testcase_04 AC 144 ms
55,596 KB
testcase_05 AC 155 ms
55,752 KB
testcase_06 AC 177 ms
56,296 KB
testcase_07 AC 144 ms
56,056 KB
testcase_08 AC 165 ms
56,208 KB
testcase_09 AC 185 ms
56,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main {
	public static void main(String[] a) {
		Scanner s=new Scanner(System.in);
		int[] C=new int[4];C[s.nextInt()]=1;
		s.nextInt();
		while(s.hasNext()){
			int i=s.nextInt(),j=s.nextInt(),t=C[i];
			C[i]=C[j];C[j]=t;
		}
		System.out.println(C[1]>0?1:C[2]>0?2:3);
	}
}
0