結果

問題 No.123 カードシャッフル
ユーザー spacenautspacenaut
提出日時 2016-05-22 15:33:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 634 ms / 5,000 ms
コード長 419 bytes
コンパイル時間 2,217 ms
コンパイル使用メモリ 74,868 KB
実行使用メモリ 48,092 KB
最終ジャッジ日時 2024-04-16 06:47:27
合計ジャッジ時間 6,786 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,248 KB
testcase_01 AC 134 ms
41,048 KB
testcase_02 AC 136 ms
41,132 KB
testcase_03 AC 140 ms
41,096 KB
testcase_04 AC 140 ms
41,268 KB
testcase_05 AC 141 ms
41,404 KB
testcase_06 AC 137 ms
41,452 KB
testcase_07 AC 133 ms
41,072 KB
testcase_08 AC 137 ms
41,276 KB
testcase_09 AC 137 ms
41,244 KB
testcase_10 AC 586 ms
47,632 KB
testcase_11 AC 597 ms
47,900 KB
testcase_12 AC 616 ms
47,752 KB
testcase_13 AC 634 ms
48,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class No0123{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int a = 0;
		ArrayList<Integer> ar = new ArrayList<Integer>();

		for(int i = 0; i < n; i++){
			ar.add(i + 1);
		}
		for(int i = 0; i < m; i++){
			a = sc.nextInt();
			ar.add(0, ar.get(a - 1));
			ar.remove(a);
		}
		System.out.println(ar.get(0));
	}
}
0