結果

問題 No.26 シャッフルゲーム
ユーザー kou6839kou6839
提出日時 2014-11-18 15:13:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 1,843 ms
コンパイル使用メモリ 71,372 KB
実行使用メモリ 56,364 KB
最終ジャッジ日時 2023-08-30 20:33:32
合計ジャッジ時間 4,056 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,148 KB
testcase_01 AC 120 ms
55,836 KB
testcase_02 AC 156 ms
56,092 KB
testcase_03 AC 131 ms
56,228 KB
testcase_04 AC 137 ms
55,900 KB
testcase_05 AC 144 ms
55,992 KB
testcase_06 AC 144 ms
55,904 KB
testcase_07 AC 137 ms
56,200 KB
testcase_08 AC 151 ms
56,364 KB
testcase_09 AC 154 ms
56,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

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