結果

問題 No.123 カードシャッフル
ユーザー 練習生練習生
提出日時 2015-08-22 11:47:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 505 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 4,020 ms
コンパイル使用メモリ 72,016 KB
実行使用メモリ 62,816 KB
最終ジャッジ日時 2023-09-25 16:01:38
合計ジャッジ時間 8,221 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,408 KB
testcase_01 AC 126 ms
55,804 KB
testcase_02 AC 127 ms
55,676 KB
testcase_03 AC 127 ms
55,956 KB
testcase_04 AC 126 ms
55,940 KB
testcase_05 AC 127 ms
55,532 KB
testcase_06 AC 125 ms
55,716 KB
testcase_07 AC 125 ms
55,856 KB
testcase_08 AC 125 ms
55,888 KB
testcase_09 AC 125 ms
55,804 KB
testcase_10 AC 471 ms
60,140 KB
testcase_11 AC 491 ms
62,816 KB
testcase_12 AC 505 ms
60,324 KB
testcase_13 AC 498 ms
60,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Template {
	public static void main(String[] args) {
		List<Integer> cardList = new ArrayList<Integer>();
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		for(int i = 0; i < n; i++){
			cardList.add(i + 1);
		}
		for(int i = 0; i < m; i++){
			int a = sc.nextInt();
			cardList.add(0, cardList.get(a - 1));
			cardList.remove(a);
		}
		sc.close();
		System.out.println(cardList.get(0));
	}
}
0