結果

問題 No.123 カードシャッフル
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-17 18:36:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 553 ms / 5,000 ms
コード長 509 bytes
コンパイル時間 3,298 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 59,572 KB
最終ジャッジ日時 2024-04-17 23:11:14
合計ジャッジ時間 7,587 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
54,084 KB
testcase_01 AC 139 ms
54,228 KB
testcase_02 AC 127 ms
54,108 KB
testcase_03 AC 127 ms
54,268 KB
testcase_04 AC 133 ms
53,856 KB
testcase_05 AC 124 ms
54,132 KB
testcase_06 AC 121 ms
52,696 KB
testcase_07 AC 128 ms
54,404 KB
testcase_08 AC 131 ms
54,332 KB
testcase_09 AC 120 ms
54,196 KB
testcase_10 AC 510 ms
59,252 KB
testcase_11 AC 519 ms
59,564 KB
testcase_12 AC 553 ms
59,572 KB
testcase_13 AC 518 ms
59,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise94{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] cards = new int[n];
    for(int i = 0; i < n; i++){
      cards[i] = i + 1;
    }
    int m = sc.nextInt();
    for(int i = 0; i < m; i++){
      int x = sc.nextInt() - 1;
      int y = cards[x];
      for(int j = x - 1; j >= 0; j--){
        cards[j + 1] = cards[j];
      }
      cards[0] = y;
    }
    System.out.println(cards[0]);
  }
}
0