結果

問題 No.123 カードシャッフル
ユーザー YamaKasaYamaKasa
提出日時 2018-05-16 23:19:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 71,628 KB
実行使用メモリ 60,980 KB
最終ジャッジ日時 2023-09-10 22:24:34
合計ジャッジ時間 6,114 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,528 KB
testcase_01 AC 121 ms
55,644 KB
testcase_02 AC 122 ms
55,872 KB
testcase_03 WA -
testcase_04 AC 121 ms
55,716 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

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

}
0