結果

問題 No.123 カードシャッフル
ユーザー taktak
提出日時 2018-03-29 21:49:49
言語 F#
(F# 4.0)
結果
AC  
実行時間 231 ms / 5,000 ms
コード長 350 bytes
コンパイル時間 4,334 ms
コンパイル使用メモリ 160,444 KB
実行使用メモリ 33,480 KB
最終ジャッジ日時 2023-09-08 06:39:19
合計ジャッジ時間 6,984 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
22,952 KB
testcase_01 AC 82 ms
25,004 KB
testcase_02 AC 79 ms
22,932 KB
testcase_03 AC 83 ms
22,908 KB
testcase_04 AC 84 ms
23,016 KB
testcase_05 AC 83 ms
25,060 KB
testcase_06 AC 84 ms
23,084 KB
testcase_07 AC 84 ms
23,020 KB
testcase_08 AC 85 ms
25,180 KB
testcase_09 AC 80 ms
23,060 KB
testcase_10 AC 117 ms
25,728 KB
testcase_11 AC 229 ms
31,528 KB
testcase_12 AC 231 ms
33,372 KB
testcase_13 AC 230 ms
33,480 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let read() = Console.ReadLine().Split() |> Array.map (int)

let N,M = let t = read() in t.[0],t.[1]
let A   = read()

A
|> Array.fold (fun acc x -> 
    match x with
    | 1            -> acc
    | x when x = N -> acc.[x-1]::acc.[..(x-2)]
    | x            -> acc.[x-1]::acc.[..(x-2)]@acc.[x..]
    ) [1..N]
|> List.head
|> printfn "%i"
0