結果

問題 No.26 シャッフルゲーム
ユーザー キョウチクキョウチク
提出日時 2022-06-10 15:03:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 647 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 74,208 KB
実行使用メモリ 57,672 KB
最終ジャッジ日時 2023-10-21 04:40:43
合計ジャッジ時間 4,266 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
57,172 KB
testcase_01 AC 133 ms
57,488 KB
testcase_02 AC 149 ms
57,580 KB
testcase_03 AC 135 ms
57,488 KB
testcase_04 AC 138 ms
57,548 KB
testcase_05 AC 145 ms
57,672 KB
testcase_06 AC 147 ms
57,636 KB
testcase_07 AC 140 ms
57,616 KB
testcase_08 AC 146 ms
55,336 KB
testcase_09 AC 148 ms
57,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc=new Scanner(System.in);
        String[] line;
        line=sc.nextLine().split(" ");
        int place=Integer.parseInt(line[0]);
        line=sc.nextLine().split(" ");
        int m=Integer.parseInt(line[0]);
        for(int i=0;i<m;i++){
            line=sc.nextLine().split(" ");
            int tmp=Integer.parseInt(line[0]),tmp1=Integer.parseInt(line[1]);
            if(place==tmp) place=tmp1;
            else if(place==tmp1) place=tmp;
        }
        System.out.println(place);
    }
}
0