結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2016-11-06 12:37:00 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 3,634 ms |
コンパイル使用メモリ | 74,428 KB |
実行使用メモリ | 54,216 KB |
最終ジャッジ日時 | 2024-11-25 03:16:54 |
合計ジャッジ時間 | 5,579 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 3 |
other | RE * 10 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numCards = sc.nextInt(); int numShuffling = sc.nextInt(); int[] cards = new int[numCards]; for (int i = 0; i < numCards; i++) { cards[i] = sc.nextInt(); } int topCard = 1; for (int i = numShuffling - 1; i >= 0; i--) { if (topCard == 1) { topCard = cards[i]; } else { if (topCard <= cards[i]) { topCard--; } } } System.out.println(topCard); } }