結果

問題 No.26 シャッフルゲーム
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 15:05:17
言語 Java19
(openjdk 21)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 71,328 KB
実行使用メモリ 56,116 KB
最終ジャッジ日時 2023-08-13 16:27:03
合計ジャッジ時間 4,222 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,388 KB
testcase_01 AC 125 ms
55,560 KB
testcase_02 AC 162 ms
55,992 KB
testcase_03 AC 136 ms
55,680 KB
testcase_04 AC 142 ms
55,672 KB
testcase_05 AC 149 ms
56,004 KB
testcase_06 AC 148 ms
56,008 KB
testcase_07 AC 140 ms
55,356 KB
testcase_08 AC 147 ms
56,116 KB
testcase_09 AC 171 ms
56,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int point = n;
		for(int i = 0 ; i < m ; i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(point == a) point = b;
			else if(point == b) point = a;
		}
		System.out.println(point);
 	}
}

0