結果
| 問題 | No.123 カードシャッフル | 
| コンテスト | |
| ユーザー |  tenten | 
| 提出日時 | 2020-10-09 13:17:22 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 526 ms / 5,000 ms | 
| コード長 | 498 bytes | 
| コンパイル時間 | 2,842 ms | 
| コンパイル使用メモリ | 75,232 KB | 
| 実行使用メモリ | 48,208 KB | 
| 最終ジャッジ日時 | 2024-07-20 06:46:14 | 
| 合計ジャッジ時間 | 5,727 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
ソースコード
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<Integer> cards = new ArrayList<>();
        for (int i = 1; i <= n; i++) {
            cards.add(i);
        }
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt() - 1;
            cards.add(0, cards.remove(x));
        }
        System.out.println(cards.get(0));
    }
}
            
            
            
        