結果

問題 No.26 シャッフルゲーム
ユーザー kou6839kou6839
提出日時 2014-11-18 15:13:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 1,834 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 54,420 KB
最終ジャッジ日時 2024-06-10 20:02:16
合計ジャッジ時間 3,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
53,776 KB
testcase_01 AC 112 ms
54,164 KB
testcase_02 AC 143 ms
54,140 KB
testcase_03 AC 121 ms
54,380 KB
testcase_04 AC 125 ms
54,292 KB
testcase_05 AC 141 ms
54,408 KB
testcase_06 AC 141 ms
54,420 KB
testcase_07 AC 138 ms
53,876 KB
testcase_08 AC 156 ms
54,372 KB
testcase_09 AC 153 ms
54,348 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