結果

問題 No.123 カードシャッフル
ユーザー htensai
提出日時 2019-12-05 11:38:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 523 ms / 5,000 ms
コード長 453 bytes
コンパイル時間 2,431 ms
コンパイル使用メモリ 75,256 KB
実行使用メモリ 59,412 KB
最終ジャッジ日時 2024-12-17 16:45:25
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i = 1; i <= n; i++) {
		    list.add(i);
		}
		int m = sc.nextInt();
		for (int i = 0; i < m; i++) {
		    int x = sc.nextInt() - 1;
		    Integer target = list.remove(x);
		    list.add(0, target);
		}
	    System.out.println(list.get(0));
	}
}
	
0