結果

問題 No.26 シャッフルゲーム
ユーザー shinwisteriashinwisteria
提出日時 2018-03-04 16:49:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 465 bytes
コンパイル時間 4,371 ms
コンパイル使用メモリ 71,892 KB
実行使用メモリ 56,560 KB
最終ジャッジ日時 2023-09-22 09:52:47
合計ジャッジ時間 5,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,700 KB
testcase_01 AC 119 ms
55,496 KB
testcase_02 AC 156 ms
56,184 KB
testcase_03 AC 130 ms
56,020 KB
testcase_04 AC 135 ms
55,684 KB
testcase_05 AC 146 ms
56,128 KB
testcase_06 AC 144 ms
56,560 KB
testcase_07 AC 136 ms
55,784 KB
testcase_08 AC 146 ms
55,956 KB
testcase_09 AC 143 ms
55,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con26 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] cup = new int[3];
		int N = s.nextInt() , M = s.nextInt();
		cup[N-1] = 1;

		for(int i = 0;i < M;i++){
			int p = s.nextInt() , q = s.nextInt() , d = cup[q-1];
			cup[q-1] = cup[p-1];
			cup[p-1] = d;
		}
		s.close();

		for(int i = 0;i < 3;i++){
			if(cup[i] == 1){
				System.out.println(i+1);
			}
		}

	}

}
0