結果

問題 No.26 シャッフルゲーム
ユーザー kou6839
提出日時 2014-11-18 15:12:18
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 331 bytes
コンパイル時間 2,664 ms
コンパイル使用メモリ 76,016 KB
実行使用メモリ 56,260 KB
最終ジャッジ日時 2025-01-02 17:02:02
合計ジャッジ時間 4,887 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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;
			if(b==n) n=a;
		}
		System.out.println(n);
	}
}	
0