結果

問題 No.5 数字のブロック
ユーザー hum_op
提出日時 2016-04-02 10:22:29
言語 F#
(F# 4.0)
結果
AC  
実行時間 361 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 14,906 ms
コンパイル使用メモリ 185,688 KB
実行使用メモリ 38,316 KB
最終ジャッジ日時 2024-11-18 08:28:22
合計ジャッジ時間 21,868 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (694 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

[<EntryPoint>]
let main argv =
    let L = int <| Console.ReadLine()
    let N = int <| Console.ReadLine()
    let Win = Console.ReadLine().Split(' ')
    let W = Array.create N 0

    for x in 0 .. N-1 do
        W.[x] <- (Int32.Parse Win.[x])
    done
    let W = Array.sort W

    let mutable c = 0
    let mutable size = 0
    for x in 0 .. N-1 do
        size <- size + W.[x]
        if size <= L then
            c <- c + 1
    done
    printfn "%d" c
    0
0