結果

問題 No.123 カードシャッフル
ユーザー ffmm00ffmm00
提出日時 2015-06-13 21:15:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 489 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 4,820 ms
コンパイル使用メモリ 72,432 KB
実行使用メモリ 60,864 KB
最終ジャッジ日時 2023-09-21 01:08:51
合計ジャッジ時間 7,485 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,952 KB
testcase_01 AC 126 ms
55,792 KB
testcase_02 AC 127 ms
55,752 KB
testcase_03 AC 125 ms
55,680 KB
testcase_04 AC 126 ms
55,716 KB
testcase_05 AC 126 ms
55,540 KB
testcase_06 AC 122 ms
56,016 KB
testcase_07 AC 125 ms
55,804 KB
testcase_08 AC 125 ms
56,264 KB
testcase_09 AC 127 ms
55,672 KB
testcase_10 AC 444 ms
60,384 KB
testcase_11 AC 487 ms
60,428 KB
testcase_12 AC 482 ms
60,624 KB
testcase_13 AC 489 ms
60,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class N123 {

	public static void main(String[] args) {
		Scanner sca = new Scanner(System.in);

		int n = sca.nextInt();
		int m = sca.nextInt();
		int[] f = new int[n];

		for (int i = 0; i < n; i++)
			f[i] = i + 1;

		for (int i = 0; i < m; i++) {
			int a = sca.nextInt() - 1;
			int t = f[a];
			for (int k = a - 1; 0 <= k; k--)
				f[k + 1] = f[k];
			f[0] = t;
		}

		System.out.println(f[0]);

	}

}
0