結果
問題 | No.123 カードシャッフル |
ユーザー |
|
提出日時 | 2016-04-28 22:28:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 203 ms / 5,000 ms |
コード長 | 794 bytes |
コンパイル時間 | 2,235 ms |
コンパイル使用メモリ | 76,652 KB |
実行使用メモリ | 50,000 KB |
最終ジャッジ日時 | 2024-10-04 17:22:38 |
合計ジャッジ時間 | 3,911 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.*;import java.math.*;public class Main {public static void main(String[] args)throws IOException{BufferedReader br = new BufferedReader(new InputStreamReader(System.in));StringBuilder sb = new StringBuilder();String[] str = br.readLine().split(" ");int n = Integer.parseInt(str[0]);int m = Integer.parseInt(str[1]);String[] str1 = br.readLine().split(" ");int[] deck = new int [n];for(int i = 0; i < n; i++)deck[i] = i+1;for(int i = 0; i < m; i++){int a = Integer.parseInt(str1[i]) -1;int tmp = deck[a];for(int j = a; j > 0; j--){deck[j] = deck[j-1];}deck[0] = tmp;}sb.append(deck[0]);System.out.println(sb);}}