結果

問題 No.156 キャンディー・ボックス
ユーザー Nobita Gomu
提出日時 2017-09-26 12:41:38
言語 F#
(F# 4.0)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 10,914 ms
コンパイル使用メモリ 203,740 KB
実行使用メモリ 35,356 KB
最終ジャッジ日時 2024-07-05 16:06:21
合計ジャッジ時間 23,987 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (256 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(14,28): warning FS0044: このコンストラクトは使用されなくなりました。please use Seq.item [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let split (s:string) = s.Split ' '

let f = split >> Seq.map int >> Seq.last
let g = split >> Seq.map int >> Seq.sort

let count =
    let m = stdin.ReadLine () |> f
    let sq = stdin.ReadLine () |> g

    let rec iter acc c =
        match (m - acc) with
        | i when i < 0 -> c - 1
        | i when i = 0 -> c
        | _ -> iter (acc + Seq.nth c sq) (c + 1)

    iter 0 0

count |> printfn "%d"
0