結果

問題 No.123 カードシャッフル
ユーザー Mcpu3
提出日時 2018-06-21 23:16:38
言語 Java
(openjdk 23)
結果
AC  
実行時間 587 ms / 5,000 ms
コード長 381 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 74,888 KB
実行使用メモリ 59,596 KB
最終ジャッジ日時 2024-06-30 17:45:40
合計ジャッジ時間 6,421 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no123{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n,m,a,c[]=new int[50],i,j,t;
		n=stdIn.nextInt();
		m=stdIn.nextInt();
		for(i=0;i<n;i++) c[i]=i+1;
		for(i=0;i<m;i++) {
			a=stdIn.nextInt();
			t=c[a-1];
			for(j=a-1;j>0;j--) c[j]=c[j-1];
			c[0]=t;
		}
		System.out.print(c[0]);
	}
}
0