結果

問題 No.26 シャッフルゲーム
ユーザー willowoooowillowoooo
提出日時 2016-06-05 03:40:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 184 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 1,992 ms
コンパイル使用メモリ 74,196 KB
実行使用メモリ 42,252 KB
最終ジャッジ日時 2024-04-17 03:56:25
合計ジャッジ時間 4,175 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
41,360 KB
testcase_01 AC 128 ms
41,368 KB
testcase_02 AC 151 ms
42,052 KB
testcase_03 AC 138 ms
41,436 KB
testcase_04 AC 146 ms
41,772 KB
testcase_05 AC 162 ms
41,808 KB
testcase_06 AC 184 ms
42,068 KB
testcase_07 AC 145 ms
41,828 KB
testcase_08 AC 154 ms
42,252 KB
testcase_09 AC 171 ms
42,068 KB
権限があれば一括ダウンロードができます

ソースコード

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