結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2017-09-24 16:05:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 608 ms / 5,000 ms |
コード長 | 541 bytes |
コンパイル時間 | 2,110 ms |
コンパイル使用メモリ | 75,016 KB |
実行使用メモリ | 59,852 KB |
最終ジャッジ日時 | 2024-11-14 07:10:20 |
合計ジャッジ時間 | 6,497 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
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());}}