結果

問題 No.123 カードシャッフル
ユーザー tak
提出日時 2018-03-29 21:49:49
言語 F#
(F# 4.0)
結果
AC  
実行時間 614 ms / 5,000 ms
コード長 350 bytes
コンパイル時間 13,742 ms
コンパイル使用メモリ 192,884 KB
実行使用メモリ 66,816 KB
最終ジャッジ日時 2024-06-25 23:54:33
合計ジャッジ時間 20,239 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (394 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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