結果

問題 No.123 カードシャッフル
ユーザー dazydazy
提出日時 2016-09-13 17:40:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 598 ms / 5,000 ms
コード長 542 bytes
コンパイル時間 3,420 ms
コンパイル使用メモリ 76,200 KB
実行使用メモリ 48,240 KB
最終ジャッジ日時 2024-04-28 13:07:38
合計ジャッジ時間 7,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
41,020 KB
testcase_01 AC 128 ms
41,020 KB
testcase_02 AC 130 ms
41,100 KB
testcase_03 AC 129 ms
41,432 KB
testcase_04 AC 114 ms
39,800 KB
testcase_05 AC 127 ms
41,268 KB
testcase_06 AC 116 ms
39,844 KB
testcase_07 AC 131 ms
41,100 KB
testcase_08 AC 135 ms
41,032 KB
testcase_09 AC 128 ms
41,180 KB
testcase_10 AC 570 ms
48,240 KB
testcase_11 AC 567 ms
48,076 KB
testcase_12 AC 564 ms
48,112 KB
testcase_13 AC 598 ms
47,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        ArrayList<Integer> C = new ArrayList<>();
        for (int i = 0; i < N; i++) C.add(i+1);
        int M = scan.nextInt();
        int A;
        for (int i = 0; i < M; i++) {
            A = scan.nextInt();
            if (A!=1) {
                C.add(0, C.get(A - 1));
                C.remove(A);
            }
        }
        System.out.println(C.get(0));
    }
}
0