結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー Nobita Gomu
提出日時 2017-09-28 01:24:21
言語 F#
(F# 4.0)
結果
AC  
実行時間 363 ms / 5,000 ms
コード長 631 bytes
コンパイル時間 13,582 ms
コンパイル使用メモリ 199,976 KB
実行使用メモリ 37,224 KB
最終ジャッジ日時 2024-06-26 08:19:36
合計ジャッジ時間 21,563 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (297 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 #

type Buf = { a:int[]; offset:int } with
    member private this.update (c:char) =
        let idx = (int c) - this.offset
        this.a.[idx] <- this.a.[idx] + 1

    member this.reader (s:string) =
        s
        |> Seq.filter (fun c -> c <> ' ')
        |> Seq.iter (fun c -> this.update c)

    member this.maxvalue =
        this.a
        |> Seq.mapi (fun i v -> (i+1, v))
        |> Seq.sortBy (fun (i, v) -> v)
        |> Seq.last
        |> fun (i, v) -> i

let buf = { a = [| for _ in 1..6 -> 0 |]; offset = int '1' }

stdin.ReadLine () |> ignore
stdin.ReadLine () |> buf.reader |> ignore

buf.maxvalue |> printfn "%d"
0