結果

問題 No.26 シャッフルゲーム
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 15:05:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 74,000 KB
実行使用メモリ 54,396 KB
最終ジャッジ日時 2024-05-01 09:14:08
合計ジャッジ時間 4,388 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,100 KB
testcase_01 AC 130 ms
54,028 KB
testcase_02 AC 158 ms
54,396 KB
testcase_03 AC 143 ms
54,120 KB
testcase_04 AC 147 ms
54,120 KB
testcase_05 AC 150 ms
54,040 KB
testcase_06 AC 153 ms
53,968 KB
testcase_07 AC 145 ms
54,024 KB
testcase_08 AC 153 ms
54,076 KB
testcase_09 AC 159 ms
54,364 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