結果

問題 No.123 カードシャッフル
ユーザー kou6839
提出日時 2015-01-15 14:25:25
言語 Java
(openjdk 23)
結果
AC  
実行時間 627 ms / 5,000 ms
コード長 537 bytes
コンパイル時間 2,469 ms
コンパイル使用メモリ 73,852 KB
実行使用メモリ 59,316 KB
最終ジャッジ日時 2024-06-22 11:39:52
合計ジャッジ時間 7,185 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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