結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2016-06-17 18:36:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 616 ms / 5,000 ms |
コード長 | 509 bytes |
コンパイル時間 | 3,449 ms |
コンパイル使用メモリ | 73,960 KB |
実行使用メモリ | 59,720 KB |
最終ジャッジ日時 | 2024-10-09 16:53:49 |
合計ジャッジ時間 | 7,846 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
import java.util.*; public class Exercise94{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] cards = new int[n]; for(int i = 0; i < n; i++){ cards[i] = i + 1; } int m = sc.nextInt(); for(int i = 0; i < m; i++){ int x = sc.nextInt() - 1; int y = cards[x]; for(int j = x - 1; j >= 0; j--){ cards[j + 1] = cards[j]; } cards[0] = y; } System.out.println(cards[0]); } }