結果

問題 No.26 シャッフルゲーム
ユーザー willowoooo
提出日時 2016-06-05 03:40:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 183 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 3,320 ms
コンパイル使用メモリ 74,780 KB
実行使用メモリ 41,768 KB
最終ジャッジ日時 2024-10-08 14:07:32
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int m,n;
		n = sc.nextInt();
		m = sc.nextInt();
		for(int i = 0; i < m;i++){
			int a,b ;
			a = sc.nextInt();
			b = sc.nextInt();
			if(n == a)
				n = b;
			else if(n == b)
				n = a;
		}
		System.out.println(n);
	}
}
0