結果

問題 No.26 シャッフルゲーム
ユーザー YOSHIYOSHI
提出日時 2021-02-17 23:19:51
言語 Java19
(openjdk 21)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 3,736 ms
コンパイル使用メモリ 76,616 KB
実行使用メモリ 56,008 KB
最終ジャッジ日時 2023-10-12 09:09:11
合計ジャッジ時間 6,190 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,992 KB
testcase_01 AC 129 ms
55,824 KB
testcase_02 AC 157 ms
56,008 KB
testcase_03 AC 131 ms
55,816 KB
testcase_04 AC 133 ms
55,748 KB
testcase_05 AC 154 ms
55,816 KB
testcase_06 AC 152 ms
55,468 KB
testcase_07 AC 133 ms
55,728 KB
testcase_08 AC 152 ms
55,944 KB
testcase_09 AC 160 ms
55,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.stream.Stream;

public class No00000026_Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = Integer.parseInt(scan.nextLine());
		int m = Integer.parseInt(scan.nextLine());
		for(int i = 0; i < m; i++) {
			int[] arr = Stream.of(scan.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
			if(arr[0] == n) {
				n = arr[1];
			} else if(arr[1] == n) {
				n = arr[0];
			}
		}

		System.out.println(n);

		scan.close();

	}

}
0