結果

問題 No.123 カードシャッフル
ユーザー k_kadorak_kadora
提出日時 2015-06-11 02:12:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 493 ms / 5,000 ms
コード長 461 bytes
コンパイル時間 3,207 ms
コンパイル使用メモリ 72,280 KB
実行使用メモリ 61,112 KB
最終ジャッジ日時 2023-09-20 20:43:24
合計ジャッジ時間 7,608 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,532 KB
testcase_01 AC 127 ms
55,784 KB
testcase_02 AC 122 ms
55,672 KB
testcase_03 AC 126 ms
55,756 KB
testcase_04 AC 125 ms
55,808 KB
testcase_05 AC 125 ms
55,960 KB
testcase_06 AC 125 ms
55,752 KB
testcase_07 AC 126 ms
55,748 KB
testcase_08 AC 126 ms
55,724 KB
testcase_09 AC 128 ms
55,944 KB
testcase_10 AC 463 ms
58,952 KB
testcase_11 AC 493 ms
61,112 KB
testcase_12 AC 492 ms
60,936 KB
testcase_13 AC 485 ms
61,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Card{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,m,temp,top;
		n = sc.nextInt();
		m = sc.nextInt();
		int[] deck = new int[n];
		for(int i = 0;i<n;i++){
			deck[i] = i + 1;
		}
		for(int i = 0;i<m;i++){
			temp = sc.nextInt()-1;
			top = deck[temp];
			for(int j = 0;j<temp;j++){
				deck[temp-j] = deck[temp-j-1];
			}
			deck[0] = top;
		}
		System.out.println(deck[0]);
	}
}
0