結果

問題 No.123 カードシャッフル
ユーザー rf141rf141
提出日時 2015-08-09 21:29:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 510 ms / 5,000 ms
コード長 612 bytes
コンパイル時間 3,386 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 60,956 KB
最終ジャッジ日時 2023-09-25 07:38:24
合計ジャッジ時間 7,314 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
54,184 KB
testcase_01 AC 123 ms
55,912 KB
testcase_02 AC 129 ms
55,828 KB
testcase_03 AC 125 ms
55,672 KB
testcase_04 AC 125 ms
55,536 KB
testcase_05 AC 124 ms
55,904 KB
testcase_06 AC 124 ms
57,908 KB
testcase_07 AC 124 ms
55,784 KB
testcase_08 AC 126 ms
55,576 KB
testcase_09 AC 126 ms
57,996 KB
testcase_10 AC 474 ms
60,504 KB
testcase_11 AC 495 ms
60,756 KB
testcase_12 AC 510 ms
60,864 KB
testcase_13 AC 508 ms
60,956 KB
権限があれば一括ダウンロードができます

ソースコード

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();
		int[] number = new int[n];
		for(int i = 0; i < n; i++){
			number[i] = i+1;
		}
		System.out.println(cardShuffle(number,m,scan));
	}
	public static int cardShuffle(int[] number,int m,Scanner scan){
		for(int i = 0; i < m; i++){
			int shuffle_number = scan.nextInt();
			int now = number[shuffle_number-1];
			for(int j = shuffle_number-1; 0 < j; j--){
				number[j] = number[j-1];
			}
			number[0] = now;
		}
		return number[0];
	}
}
0