結果

問題 No.123 カードシャッフル
ユーザー TatsuDX
提出日時 2016-09-08 23:51:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 580 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 3,285 ms
コンパイル使用メモリ 74,728 KB
実行使用メモリ 59,404 KB
最終ジャッジ日時 2024-11-15 22:30:57
合計ジャッジ時間 7,561 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

		int n = sc.nextInt(), m = sc.nextInt(), idx, tmp;
		int[] t = new int[n];
		for (int i = 0; i < n; i++) {
			t[i] = i + 1;
		}
		for (int i = 0; i < m; i++) {
			idx = sc.nextInt() - 1;
			tmp = t[idx];
			for (int j = idx; j > 0; j--) {
				t[j] = t[j - 1];
			}
			t[0] = tmp;
		}
		System.out.println(t[0]);
	}
}
0