結果

問題 No.26 シャッフルゲーム
ユーザー dazydazy
提出日時 2016-09-08 17:29:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 174 ms / 5,000 ms
コード長 550 bytes
コンパイル時間 3,194 ms
コンパイル使用メモリ 72,280 KB
実行使用メモリ 56,136 KB
最終ジャッジ日時 2023-08-09 23:52:41
合計ジャッジ時間 5,429 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,964 KB
testcase_01 AC 124 ms
55,824 KB
testcase_02 AC 168 ms
55,828 KB
testcase_03 AC 136 ms
55,852 KB
testcase_04 AC 139 ms
55,520 KB
testcase_05 AC 153 ms
55,796 KB
testcase_06 AC 148 ms
55,524 KB
testcase_07 AC 141 ms
53,600 KB
testcase_08 AC 154 ms
55,772 KB
testcase_09 AC 174 ms
56,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int M = scan.nextInt();
        if (N < 1||N > 3||M < 1||M > 200) System.exit(1);
        int P,Q;
        for (int i = 0; i < M; i++) {
            P = scan.nextInt();
            Q = scan.nextInt();
            if (P < 1||P > 3||Q < 1||Q > 3||P==Q) System.exit(1);
            if (P==N) N = Q;
            else if (Q==N) N = P;
        }
        System.out.println(N);
    }
}
0