結果

問題 No.123 カードシャッフル
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 06:22:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 484 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 71,436 KB
実行使用メモリ 61,348 KB
最終ジャッジ日時 2023-08-17 04:09:57
合計ジャッジ時間 6,228 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,116 KB
testcase_01 AC 120 ms
56,156 KB
testcase_02 AC 121 ms
55,560 KB
testcase_03 AC 129 ms
55,968 KB
testcase_04 AC 123 ms
56,192 KB
testcase_05 AC 121 ms
55,856 KB
testcase_06 AC 120 ms
56,308 KB
testcase_07 AC 120 ms
55,744 KB
testcase_08 AC 121 ms
56,416 KB
testcase_09 AC 125 ms
55,812 KB
testcase_10 AC 444 ms
60,604 KB
testcase_11 AC 484 ms
61,348 KB
testcase_12 AC 476 ms
61,036 KB
testcase_13 AC 478 ms
61,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] C = new int [N];
        for(int i=0; i<N; i++){
            C[i] = i+1;
        }
        int M = sc.nextInt();
        for(int j=0; j<M; j++){
            int A = sc.nextInt();
            int t = C[A-1];
            for(int k=0; k<A-1; k++){
                C[A-1-k]=C[A-2-k];
            }
            C[0]=t;
        }
        System.out.println(C[0]);
    }
}
0