結果

問題 No.123 カードシャッフル
ユーザー dogwood0424dogwood0424
提出日時 2018-01-04 20:35:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 465 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 3,496 ms
コンパイル使用メモリ 71,992 KB
実行使用メモリ 60,732 KB
最終ジャッジ日時 2023-08-24 19:00:10
合計ジャッジ時間 7,484 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,740 KB
testcase_01 AC 121 ms
55,648 KB
testcase_02 AC 120 ms
55,864 KB
testcase_03 AC 120 ms
55,552 KB
testcase_04 AC 120 ms
55,592 KB
testcase_05 AC 121 ms
55,752 KB
testcase_06 AC 120 ms
55,860 KB
testcase_07 AC 123 ms
55,524 KB
testcase_08 AC 121 ms
55,672 KB
testcase_09 AC 119 ms
55,756 KB
testcase_10 AC 432 ms
60,252 KB
testcase_11 AC 465 ms
60,732 KB
testcase_12 AC 452 ms
60,720 KB
testcase_13 AC 453 ms
60,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class No123 {
	public static void main(String[]args) {
		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();
		}
		int []b=new int[n];
		for(int i=0;i<n;i++) {
			b[i]=i+1;
		}
		int []t=new int[1];

		for(int i=0;i<m;i++) {
			t[0]=b[a[i]-1];
			for(int j=a[i]-1;j>0;j--) {
				b[j]=b[j-1];
			}
			b[0]=t[0];
		}

		System.out.println(b[0]);
		sc.close();
	}

}
0