結果

問題 No.123 カードシャッフル
ユーザー kou6839kou6839
提出日時 2015-01-15 14:25:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 530 ms / 5,000 ms
コード長 537 bytes
コンパイル時間 5,966 ms
コンパイル使用メモリ 71,428 KB
実行使用メモリ 61,204 KB
最終ジャッジ日時 2023-09-04 13:07:04
合計ジャッジ時間 9,411 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,860 KB
testcase_01 AC 129 ms
55,640 KB
testcase_02 AC 128 ms
55,384 KB
testcase_03 AC 128 ms
55,552 KB
testcase_04 AC 132 ms
55,712 KB
testcase_05 AC 133 ms
55,400 KB
testcase_06 AC 130 ms
55,820 KB
testcase_07 AC 133 ms
55,680 KB
testcase_08 AC 130 ms
53,844 KB
testcase_09 AC 130 ms
55,372 KB
testcase_10 AC 489 ms
60,640 KB
testcase_11 AC 500 ms
61,068 KB
testcase_12 AC 486 ms
61,140 KB
testcase_13 AC 530 ms
61,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] ca = new int[n];
        for(int i=0;i<n;i++){
        	ca[i]=i+1;
        }
        for(int i=0;i<m;i++){
        	int a = sc.nextInt();
        	int temp = ca[a-1];
        	for(int j=a-1;j>=1;j--){
        		ca[j]=ca[j-1];
        	}
        	ca[0]=temp;
        }
        System.out.println(ca[0]);
    }
}		
0