結果

問題 No.123 カードシャッフル
ユーザー FVRChanFVRChan
提出日時 2017-09-24 16:05:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 613 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 2,370 ms
コンパイル使用メモリ 76,028 KB
実行使用メモリ 59,856 KB
最終ジャッジ日時 2024-04-26 17:34:12
合計ジャッジ時間 6,843 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
54,096 KB
testcase_01 AC 135 ms
53,996 KB
testcase_02 AC 138 ms
53,808 KB
testcase_03 AC 136 ms
53,932 KB
testcase_04 AC 135 ms
53,976 KB
testcase_05 AC 136 ms
53,944 KB
testcase_06 AC 136 ms
54,380 KB
testcase_07 AC 134 ms
54,180 KB
testcase_08 AC 136 ms
54,080 KB
testcase_09 AC 135 ms
54,152 KB
testcase_10 AC 591 ms
59,432 KB
testcase_11 AC 605 ms
59,608 KB
testcase_12 AC 583 ms
59,856 KB
testcase_13 AC 613 ms
59,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.LinkedList;
import java.util.Scanner;
public class Main{
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
		int n,m,are[];
		String ss[]=sc.nextLine().split(" ");
		n=Integer.parseInt(ss[0]);
		m=Integer.parseInt(ss[1]);
		LinkedList<Integer>queue=new LinkedList<Integer>();
		for(int i=1;i<=n;i++){
			queue.offerLast(i);
		}
		for(int i=0;i<m;i++){
			int temp=sc.nextInt()-1;
			queue.offerFirst(queue.remove(temp));
		}sc.close();
		System.out.println(queue.getFirst());
	}
}
0