結果

問題 No.123 カードシャッフル
ユーザー rf141rf141
提出日時 2015-08-09 21:20:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 3,370 ms
コンパイル使用メモリ 73,672 KB
実行使用メモリ 62,868 KB
最終ジャッジ日時 2023-09-25 07:37:54
合計ジャッジ時間 7,722 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.util.*;
public class card{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = 1; i <= n; i++){
			list.add(i);
		}
		int[] shuffle = new int[m];
		for(int i = 0; i < m; i++){
			shuffle[i] = scan.nextInt();
		}
		System.out.println(cardShuffle(list,shuffle));
	}
	public static int cardShuffle(ArrayList<Integer> list,int[] shuffle){
		for(int i = 0;i < shuffle.length; i++){
			int now = list.get(shuffle[i]);
			list.remove(shuffle[i]);
			list.add(0,now);
		}

		return list.get(0);
	}
}
0