結果

問題 No.123 カードシャッフル
ユーザー TatsuDX
提出日時 2016-09-08 23:49:50
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 450 bytes
コンパイル時間 3,388 ms
コンパイル使用メモリ 74,324 KB
実行使用メモリ 48,132 KB
最終ジャッジ日時 2024-11-15 22:30:46
合計ジャッジ時間 7,729 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 4 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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[idx] = t[idx - 1];
			}
			t[0] = tmp;
		}
		System.out.println(t[0]);
	}
}
0