結果

問題 No.123 カードシャッフル
ユーザー 37zigen37zigen
提出日時 2016-03-11 20:11:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 555 ms / 5,000 ms
コード長 602 bytes
コンパイル時間 3,528 ms
コンパイル使用メモリ 77,328 KB
実行使用メモリ 65,728 KB
最終ジャッジ日時 2023-10-25 05:28:39
合計ジャッジ時間 7,961 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
56,376 KB
testcase_01 AC 150 ms
57,488 KB
testcase_02 AC 150 ms
57,648 KB
testcase_03 AC 149 ms
57,800 KB
testcase_04 AC 149 ms
57,632 KB
testcase_05 AC 148 ms
57,416 KB
testcase_06 AC 155 ms
55,492 KB
testcase_07 AC 153 ms
57,308 KB
testcase_08 AC 139 ms
56,368 KB
testcase_09 AC 150 ms
57,676 KB
testcase_10 AC 513 ms
62,144 KB
testcase_11 AC 555 ms
65,728 KB
testcase_12 AC 530 ms
63,688 KB
testcase_13 AC 544 ms
62,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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");

	}
}
0