結果
| 問題 | No.123 カードシャッフル | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-03-11 20:11:11 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 621 ms / 5,000 ms | 
| コード長 | 602 bytes | 
| コンパイル時間 | 3,708 ms | 
| コンパイル使用メモリ | 76,828 KB | 
| 実行使用メモリ | 59,584 KB | 
| 最終ジャッジ日時 | 2024-09-25 00:53:40 | 
| 合計ジャッジ時間 | 7,962 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
ソースコード
package 練習;
import java.util.Date;
import java.util.Scanner;
public class main{
	public static void main(String[] args){
		long exec_time=new Date().getTime();
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[] a=new int[m];
		for(int i=0;i<m;i++){
			a[i]=sc.nextInt()-1;
		}
		int[] now=new int[n];
		for(int i=0;i<n;i++){
			now[i]=i+1;
		}
		for(int i=0;i<m;i++){
			int tmp=now[a[i]];
			for(int j=a[i];j>=1;j--){
				now[j]=now[j-1];
			}
			now[0]=tmp;
		}
		System.out.println(now[0]);
		System.err.println(new Date().getTime()-exec_time+"ms");
	}
}
            
            
            
        